note 75121 rejected from language.oop5.basic by tularis

From: Date: Sun, 13 May 2007 19:10:00 +0000
Subject: note 75121 rejected from language.oop5.basic by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126569@lists.php.net to get a copy of this message
Note Submitter: el_profesorfr at yahoo dot fr ---- I'm using PHP 5.2.0-8 and it the inline initialization of properties seems to be limited to constant expressions only: <? define ('A', 0x10); define ('B', 0x20); class toto { public $a = A + B; function disp () { echo $this->a; } } $t = new toto (); $t->disp (); ?> will yield "Parse error: syntax error, unexpected '+', expecting ',' or ';'". Not sure if it's a feature or a bug... Anyway, array declarations are ok: <? class toto { public $a = array ('abc', 'def'); function disp () { var_dump ($this->a); } } $t = new toto (); $t->disp (); ?> is fine.

« previous php.notes (#126569) next »