Re: Using a variable to call another variable
| From: | Martin Marques | Date: | Sat, 09 Sep 2006 22:33:57 +0000 |
| Subject: | Re: Using a variable to call another variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241548@lists.php.net to get a copy of this message | ||
On Sat, 09 Sep 2006 08:55:35 -0500, Christopher Weldon <cweldon@cerberusonline.com> wrote:
>
> class myClass {
> private var $_001;
> private var $_002;
> private var $_003;
>
> public function access_var($var) {
> return $this->$$var;
> }
> }
>
> $cs = new myClass;
> $cs->access_var('_001');
How about call a function whose name is returned from the function myFunc()? :-D
Ansewer:
{myFunc()}()
My 2 cents.
--
---------------------------------------------------------
Lic. Martín Marqués | SELECT 'mmarques' ||
Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional | DBA, Programador,
del Litoral | Administrador
---------------------------------------------------------