dynamic variables in a while loop?

From: Date: Wed, 15 Jan 2003 12:50:08 +0000
Subject: dynamic variables in a while loop?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131687@lists.php.net to get a copy of this message
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

« previous php.general (#131687) next »