Re: eval()

From: Date: Mon, 20 May 2002 17:41:15 +0000
Subject: Re: eval()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-98485@lists.php.net to get a copy of this message
Sorry, please change line 2 with $x="q$i". Bogdan Bogdan Stancescu wrote:
for ($i = 1; $i <= 3; $i++) { $x= "$q$i"; $val=$$x; echo"<b>$val</b>\n"; echo"<br><input type=\"hidden\" name=\"a".$i."\" value=\"\">\n"; } jtjohnston wrote:
I know I'm not doing this right, but .. What I want to do is display the value of $q1 through $q3. How? I can't get eval() to do it, can I? for ($i = 1; $i <= 3; $i++) { $x= eval ("\$q".$i); echo"<b>$x</b>\n"; echo"<br><input type=\"hidden\" name=\"a".$i."\" value=\"\">\n"; } John


« previous php.general (#98485) next »