Re: call function as variable

From: Date: Sat, 16 Aug 2003 17:16:01 +0000
Subject: Re: call function as variable
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-159800@lists.php.net to get a copy of this message
Tanks a lot! this is exactly that i want!! Cheers Michael Sims wrote:
On Sat, 16 Aug 2003 07:58:27 +0200, you wrote:
$test = array(1=>foo,2=zoo); and i want to call the fuction foo() and zoo something like; $object->$test[1]();
I've never used this myself, but this should work: call_user_func(&$object, $test[1]); See: http://www.php.net/manual/en/function.call-user-func.php HTH


« previous php.general (#159800) next »