Hi!

> Why can't we create a new object and assign it to property like this?

Because the engine doesn't run code when parsing class definitions so
defaults should be constants (otherwise would also create a lot of
trouble for bytecode caching as object are not cacheable).

Use ctor for complex initializations.

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to