class as default property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux