Using a variable to call another variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PHP List,

I have a list of variables:

$001
$002
$003
$004

And what I'd like to do is have a function which will select and return one of them. Something like:

public function returnVar($n)
{
return $(somehow n is made to reference the name of the variable);
}

And then in later scripts I can call anyone of the variables by saying

returnVar(001)

Or something like that.

I've been scratching my head on how to do this for a while. I thought the answer might lie somewhere in call_user_func(), but even if it is I can't determine how.

Any advice would be much appreciated.

Thank you for your time.

--
Dave M G
Ubuntu 6.06 LTS
Kernel 2.6.17.7
Pentium D Dual Core Processor
PHP 5, MySQL 5, Apache 2

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux