php-general | 2001092
Date: 09/25/01
- Next message: Fábio Migliorini: "Re: [PHP] Variable naming"
- Previous message: Boget, Chris: "RE: [PHP] Variable naming"
- Maybe in reply to: Kyle Moore: "[PHP] Variable naming"
- Next in thread: Kyle Moore: "Re: [PHP] Variable naming"
- Reply: Kyle Moore: "Re: [PHP] Variable naming"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
$id = 1;
${"sql_" . $id} = "hey";
print $sql_1;
Try that
-----Original Message-----
From: Kyle Moore [mailto:kmoore <email protected>]
Sent: Tuesday, September 25, 2001 9:15 AM
To: php-general <email protected>
Subject: [PHP] Variable naming
I want to use the value of a variable in a variable name. For instance:
$id = 1;
$sql_$id = "hey"; //set variable $sql_1 to hey
print $sql_1; //should print hey
I have looked high and low on how to do this. My first idea was eval but I
can't seem to get that to work in this instance. Any ideas? I'm sure it is
possible and easy but I just can't figure out how to do this in php.
Thanks
-- Kyle-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Fábio Migliorini: "Re: [PHP] Variable naming"
- Previous message: Boget, Chris: "RE: [PHP] Variable naming"
- Maybe in reply to: Kyle Moore: "[PHP] Variable naming"
- Next in thread: Kyle Moore: "Re: [PHP] Variable naming"
- Reply: Kyle Moore: "Re: [PHP] Variable naming"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

