Re: How can I access the value in a variable whos name is in a string

From: Date: Sat, 18 May 2002 22:01:34 +0000
Subject: Re: How can I access the value in a variable whos name is in a string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-98296@lists.php.net to get a copy of this message
On Sat, 18 May 2002, Henry wrote: > $variablename="variable"; > eval("\$".$variablename."=13;"); > echo $variable; > > This works fine!! It echoes "13"; > > But this doesn't -> > > echo eval("\"$variablename\""); > > Why?? Because a variable just standing there on its own doesn't have a return value. You can echo eval("return \"$variablename\""); or you can just echo $$variablename; miguel

« previous php.general (#98296) next »