Re: call function as variable

From: Date: Sat, 16 Aug 2003 11:30:14 +0000
Subject: Re: call function as variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159791@lists.php.net to get a copy of this message
adam wrote:
Hi! I have folowing function which they are a member in a class. function foo(){ something } function zoo(){ something else } and i have a array such: $test = array(1=>foo,2=zoo); and i want to call the fuction foo() and zoo something like; $object->$test[1]();
Try: {$object->$test[1]}(); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals – www.phparch.com

« previous php.general (#159791) next »