Re: get an object property

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

 



On 9/12/09 1:32 AM, "Lars Torben Wilson" <torben@xxxxxxx> wrote:

> Tom Worster wrote:
>> if i have an expression that evaluates to an object, the return value from a
>> function, say, and i only want the value of one of the objects properties,
>> is there a tidy way to get it without setting another variable?
>> 
>> to illustrate, here's something that doesn't work, but it would be
>> convenient if it did:
>> 
>> $o = array( (object) array('a'=>1), (object) array('a'=>2) );
>> 
>> if ( end($o)->a > 1 ) {  // can't use -> like this!
>> ...
>> }
> 
> What version of PHP are you using? Your example should work.
> 
> Torben

5.2.9.

what version does it work in?



-- 
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