Re: how to get var value
| From: | Johannes Janson | Date: | Thu, 26 Apr 2001 13:01:27 +0000 |
| Subject: | Re: how to get var value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-50451@lists.php.net to get a copy of this message | ||
hi,
by .= you assign the value to a var in this case a string.
$test = 1;
$var = "test";
$newvar = $$var;
echo $newvar; // outputs "1"
Johannes
"AJDIN BRANDIC" <abrandic@coventry.ac.uk> schrieb im Newsbeitrag
news:Pine.OSF.3.91.1010426114338.17213A-100000@leofric...
> Hi,
>
> (this is just an example)
> I have on one page
>
> $test=1;
> $var1='test';
>
> on another page I want to be able to construct variable from the value in
> $var1 (test in this case) and print its value. So,
>
> $newvar=$;
> $newvar.=echo"$var1";
>
> now $newvar contains string '$test' but not the value of $test (1 in this
> case).
>
> There has to be way aroud this but I am just cannot find it :(.
>
> Regards
>
> Ajdin
>
> --
> 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
>