Re: [PHP] call function as variable

2003-08-16 Thread adam
Tanks a lot! This was exactly that i wanted! Cheers David Otton wrote: On Sat, 16 Aug 2003 07:58:27 +0200, you wrote: 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);

Re: [PHP] call function as variable

2003-08-16 Thread adam
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_f

Re: [PHP] call function as variable

2003-08-16 Thread Michael Sims
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

Re: [PHP] call function as variable

2003-08-16 Thread David Otton
On Sat, 16 Aug 2003 07:58:27 +0200, you wrote: >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 somethin

Re: [PHP] call function as variable

2003-08-16 Thread adam
I got this error: Parse error: parse error, unexpected '{' in ... Cheers John W. Holmes wrote: 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);

Re: [PHP] call function as variable

2003-08-16 Thread John W. Holmes
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->$tes