Re: Variables within variable names
| From: | Fearless Froggie | Date: | Fri, 03 May 2002 17:16:08 +0000 |
| Subject: | Re: Variables within variable names | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-95934@lists.php.net to get a copy of this message | ||
Once I had a bit of experience with variable
variables, I found them very useful.
But I did discover that you can't embed variable
variables (or values from arrays) in the SQL
statements I was sending to MySQL. I had to create a
temporary variable for use in my SQL statements. I'm
not sure why, whether I was missing something.
Rita Mikusch
-----Original Message-----
From: HeyJim [mailto:HeyJim@TheMadScientist.net]
Sent: Thursday, May 02, 2002 10:26 PM
To: Jackson Miller; php-general@lists.php.net
Subject: Re: Variables within variable names
I agree with Jason and Miguel, but if you really want
to do this, you could
try:
$type = "basic";
$user = $type."_user";
$$user = "jaxn";
echo $basic_user;
I can see where something like this *could* be useful,
but I'd still use
the arrays.
Jim.
At 12:43 PM 5/2/02, Jackson Miller wrote:
>I want to do something along the lines of:
>
>$type = "basic";
>$$type_user = "jaxn";
>echo $basic_user;
>
>and have the output be "jaxn".
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com