Re: unexpected T_NEW on object property
| From: | Richard Lynch | Date: | Fri, 21 Apr 2006 20:04:58 +0000 |
| Subject: | Re: unexpected T_NEW on object property | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234510@lists.php.net to get a copy of this message | ||
On Fri, April 21, 2006 2:17 pm, Paul Barry wrote:
> public $address = new Address();
I believe this is true:
At this time, you can only initialize class properties to CONSTANTS.
So you could use 'Address' or 42 or NULL or TRUE/FALSE, but not new
Address();
Actually, I think an array might also be do-able, come to think of it...
But for sure, the error message is saying you can't have 'new' there.
You'll have to initialize $this->address in the constructor.
--
Like Music?
http://l-i-e.com/artists.htm