RE: [PHP] Variable naming

From: Date: Tue, 25 Sep 2001 18:40:07 +0000
Subject: RE: [PHP] Variable naming
Groups: php.general 
Request: Send a blank email to php-general+get-68754@lists.php.net to get a copy of this message
Read this http://www.php.net/manual/en/language.variables.variable.php Johan www.pongworld.com php tt -----Original Message----- From: Fábio Migliorini [mailto:migliori@atua.com.br] Sent: Tuesday, September 25, 2001 12:28 PM To: php-general@lists.php.net Subject: Re: [PHP] Variable naming $id = 1; $sql_1 = "hey"; $vname = "sql_".$id; echo $$vname; -- Fábio Migliorini http://www.atua.com.br migliori@atua.com.br UIN: 42729458 Linux User: 175409 ----- Original Message ----- From: "Kyle Moore" <kmoore@trustamerica.com> To: <php-general@lists.php.net> Sent: Tuesday, September 25, 2001 1:15 PM 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@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 > -- 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

« previous php.general (#68754) next »