You can also use this syntax :
$var1="variable 1";
$var2="variable 2";
for ($i= 1; $i < 3; $i++)
{
  echo ${"var$i"};
}

-----Message d'origine-----
De : Olivier Masudi [mailto:[EMAIL PROTECTED]]
Envoyé : vendredi 30 novembre 2001 12:02
À : [EMAIL PROTECTED]
Objet : [PHP] HELP URGENT VARS !!!


$name1=a; $name2=b;....

I want to do this

for($i=0;$i<$nbname;$i++)
 echo "\$name$i";

output : a b ....

where "\$name$i"    =  $name1 , $name2 , $name3 ......

I try to print tha value of the vars $name1,.....  not the string
$name1,....

Is it possible ????


REM : The vars $name1,.... com from a form where the number of  name input
are variable.


Thank you


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to