Re: Problem with variable functions
| From: | Charles Killian | Date: | Wed, 12 Jul 2000 18:26:32 +0000 |
| Subject: | Re: Problem with variable functions | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6213@lists.php.net to get a copy of this message | ||
The problem is you are using a variable variable and not pulling the
function name out of the variable:)
Check out:
http://www.zend.com/manual/language.variables.variable.php
So if $$function() still doesn't work, here's my example corrected:
$function = "\$classname->sett"
call_user_func($$function);
Charles
----- Original Message -----
From: "Björn Schotte" <bjoern@baer.main.de>
To: "Charles Killian" <Charles@alcatrazdesigngroup.com>
Cc: <php-general@lists.php.net>
Sent: Wednesday, July 12, 2000 11:16 AM
Subject: Re: [PHP] Problem with variable functions
> Hi,
>
> * Charles Killian wrote:
> > if that doesn't work, maybe this will:
> > $function = "classname->sett"
> > call_user_func($function);
>
> At http://www.zugeschaut-und-mitgebaut.de/php/,
> I found call_user_method(). Seems that this will
> be 50% of the solution -- as my application reads
> $function out of a database, I have to regexp if
> a method call should be made or it's a normal function.
>
> Thanks so far, Björn.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>