Looping a variable (PHP)

Soldato
Joined
27 Dec 2005
Posts
17,315
Location
Bristol
I have a list of variables, let's say $v1, $v2, $v3, $v4 etc. I want to do a while and check if their contents, whilst changing the digit during the loop. For example (though this doesn't work obviously).

while($num < 10){
if($v$num){
// do stuff
}
$num++
}

With the if() changing to $v1, $v2 etc as the while cycles through each time. How do I do this?
 
Back
Top Bottom