Re: unexpected T_NEW on object property

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

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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