class as default property

From: Date: Mon, 23 Jun 2008 08:36:34 +0000
Subject: class as default property
Groups: php.general 
Request: Send a blank email to php-general+get-275795@lists.php.net to get a copy of this message
Hey all, I had a quick question. How come I can do this: <?php class Foo { } class Bar { public $f = 'SomeFoo'; } ?> But this does not work: <?php class Foo { } class Bar { public $f = new Foo(); } ?> *(Parse error: syntax error, unexpected T_NEW in test.php on line 8)* ** Thanks! (I'm running on the 5.3 dev branch)

« previous php.general (#275795) next »