Ryan Jameson (USA) wrote:
Hi Folks,
I've been using variable variables for years with PHP.
I'm not really sure this is really good practice. Sure, php allows it
but I think you should try to avoid them.
$var = myVarName;
$$var = Some Val;
echo $myVarName; //outputs Some Val
Today I am
Ryan Jameson (USA) wrote:
Hi Folks,
I've been using variable variables for years with PHP.
$var = myVarName;
$$var = Some Val;
echo $myVarName; //outputs Some Val
[snip]
Example:
$var['first']='bob';
$var['second']='frank';
$varName = myVarName;
$$varName = $var;
echo $$varName['second']; //should
Do you mean something like this:
http://www.weberdev.com/get_example-4065.html
It creates a quick associative array from the resultset
Bastien
From: Ryan Jameson (USA) [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Variable Variable Array
Date: Thu, 10 Mar 2005 11:56:16 -0700
Hi
: Thursday, March 10, 2005 12:19 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Variable Variable Array
Ryan Jameson (USA) wrote:
Hi Folks,
I've been using variable variables for years with PHP.
$var = myVarName;
$$var = Some Val;
echo $myVarName; //outputs Some Val
[snip]
Example
Evert|Rooftop Solutions wrote:
Ryan Jameson (USA) wrote:
I've been using variable variables for years with PHP.
I'm not really sure this is really good practice. Sure, php allows it
but I think you should try to avoid them.
[snip]
It's excellent practice to use dynamic variables* when you need
PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Variable Variable Array
Evert|Rooftop Solutions wrote:
Ryan Jameson (USA) wrote:
I've been using variable variables for years with PHP.
I'm not really sure this is really good practice. Sure, php allows it
but I think you should try to avoid
Ryan Jameson (USA) wrote:
Dynamic Variable sounds good. :-) I use them all the time, and they are
often necessary. Probably not in this case though, I like to throw them
in to confuse the newbs.. :-) J/K
Try regular expressions, it confuses them even more :)
Anyway, could you point me to a