RE: [PHP] Variable in a variable.

From: Date: Tue, 01 Aug 2000 21:53:37 +0000
Subject: RE: [PHP] Variable in a variable.
Groups: php.general 
Request: Send a blank email to php-general+get-9574@lists.php.net to get a copy of this message
I don't believe you need the $ in the value of $name_var This will probably work better: $name_var = "name1"; #note no $ sign $$name_var = "milton"; RW -----Original Message----- From: Milton Thomas [mailto:millie@colis.com] Sent: Tuesday, August 01, 2000 4:47 PM To: plist Subject: [PHP] Variable in a variable. I have some variables in a form they are name, year, url. I have 10 rows of these variables. so the are named name1, year1, url1, name2, year2, url2..... when i click submit i want to create a loop from 1 to 10 and read these variables. eg. for($x=1;$x<=10;$x++){ $name_var = "$"."name".$x echo $$name_var } what i am expecting is.. eg name1 ="milton" $name_var="$name1"; $$name_var ="milton" this worked in PHP3 I cant get it to work now. any suggestion Milton C. Thomas Freelance Web Developer Resume : http://resumes.dice.com/millie -- 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 (#9574) next »