Re: call function as variable
| From: | Michael Sims | Date: | Sat, 16 Aug 2003 16:35:56 +0000 |
| Subject: | Re: call function as variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159799@lists.php.net to get a copy of this message | ||
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