Re: How can I access the value in a variable whos name is in a string
| From: | Henry | Date: | Sat, 18 May 2002 14:33:32 +0000 |
| Subject: | Re: How can I access the value in a variable whos name is in a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98259@lists.php.net to get a copy of this message | ||
I found one way I can do the following
eval("\$val=\$".$variation.";");
echo $val;
Is there a better way?
Henry
"Henry" <henry@teacake.f9.co.uk> wrote in message
news:20020518142833.40201.qmail@pb1.pair.com...
> Dear All,
>
> $variablename="variable";
> eval("\$".$variablename."=13;");
> echo $variable;
>
> This works fine!! It echoes "13";
>
> But this doesn't ->
>
> echo eval("\"$variablename\"");
>
> Why??
>
>
> Henry
>
>
>