Re: Converting String to Variable
| From: | (Chris Adams) | Date: | Sat, 03 Mar 2001 17:07:08 +0000 |
| Subject: | Re: Converting String to Variable | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42471@lists.php.net to get a copy of this message | ||
On 3 Mar 2001 08:02:16 -0800, Randy Johnson <programmer@jennybug.com> wrote:
>Is there anyway to convert a string to a variable
>
>example
>
>$str="monday";
>
>I would like to then do this:
>
>$monday="blah";
extract() does something like that for arrays. There's no way to write the code
the way you have it, but you could use this syntax, which is equivalent:
$$str = "blah";
$GLOBALS[$str] = "blah";