note 49691 deleted from language.oop by danbrown

From: Date: Sat, 07 Nov 2009 19:03:31 +0000
Subject: note 49691 deleted from language.oop by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162563@lists.php.net to get a copy of this message
Note Submitter: arjini at gmail dot com ---- Didn't see this anywhere obvious, so I'm posting it here. To access a memeber of an array with another variable you use $arr[$name] To access a class method or property, you use $obj->{$name} You can also use the return value of a function. <?php class Test { function methodName(){ echo 'works!'; } } function getName(){ return 'methodName'; } $t = new Test(); $t->{getName()}(); //works! ?>

« previous php.notes (#162563) next »