?php / * None of these will work in PHP 4. * / class Cart {var $todays_date = date("Y-m-d"); var $name = $firstname; var $owner = 'Fred '. 'Jones'; var $items = array("VCR", "TV");} / * This is how it should be done. * / class Cart {var $todays_date; var $name; var $owner; var $items; function Cart() {$this - todays_date = date("Y-m-d"); $this - name = $GLOBALS['firstname']; / * etc... * /}}?
?php / * Aucune de ces syntaxes ne fonctionnera en PHP 4 * / class Caddie {var $date_du_jour = date("d / m/Y"); var $name = $firstname; var $owner = 'Fred '. 'Jones'; var $items = array("DVD", "Télé" ,"Magnétoscope");} / * Voici comment cela doit se faire désormais. * / class Caddie {var $date_du_jour; var $name; var $owner; var $items; function Caddie() {$this - date_du_jour = date("d / m/Y"); $this - name = $GLOBALS['firstname']; / * etc... * /}}?