get an object property

From: Date: Fri, 11 Sep 2009 23:31:01 +0000
Subject: get an object property
Groups: php.general 
Request: Send a blank email to php-general+get-297933@lists.php.net to get a copy of this message
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! ... }

« previous php.general (#297933) next »