for($ii=1; $ii<20; $ii++) { $helpz = "help$ii"; if(${$helpz} == "yes) { } else { } } ----- Original Message ----- From: "Philipp Hartmann" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, January 15, 2003 6:50 AM Subject: [PHP] dynamic variables in a while loop?
Hi everyone. I am more of an ActionScript person, but I have to do this one in php. Should be easy for everyone familiar with php syntax... Here is what I want to do: I am getting several variables into a Php Script such as: help1 = "yes" / "no" help2 = "yes" / "no" . . . helpX = "yes" / "no" I need to check whether the variable is true or false, and according to that add 1 to a counter variable. Something like this I'd do in ActionScript, but dont know about php [CODE] $i = 0; While (++$i <= 8) { if ([help]+$i=="yes"){ // this line produces an error... $counterYes += counterYes; } } [/CODE] Do I have to initialize all variables before I can use them in php? Thank you very, very much for your time and your help!! Philipp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php