Re: using a variable to a function call
| From: | Nico Vrouwe | Date: | Thu, 07 Mar 2002 15:09:07 +0000 |
| Subject: | Re: using a variable to a function call | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87634@lists.php.net to get a copy of this message | ||
You could try something like this:
eval( "\$class->" . $var . "_function();" );
/nico
"Matt Williams" <lists@yewlands.com> wrote in message
news:200203071427.g27ERd021202@mx0.rmplc.co.uk...
> Hi all
>
> I get a variable that is set be a select box on a page.
> I want to use this variable to call a function within a class that is
based
> on it's name.
>
> so if $var = "me"
>
> I want to call $class->me_function();
>
> or if
>
> $var = "you"
>
> call
>
> $class->you_function();
>
> How can I use the variable as part of the function name to call.
>
> TIA
>
> matt