Re: get an object property
| From: | John Corry | Date: | Sat, 12 Sep 2009 00:00:28 +0000 |
| Subject: | Re: get an object property | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297934@lists.php.net to get a copy of this message | ||
Wouldn't it be $o[1]->a?
J Corry
Sent from my iPhone
On Sep 11, 2009, at 7:31 PM, Tom Worster <fsb@thefsb.org> 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! ... } --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php