I need to make sure all variables $num1,$num2, $num3, $num4, $num5 are numbers between 0-9.
I'm using:
if(ereg("([1-9]*)$",VARIABLE)) {
echo "valid";
}
I can get one variable to work but how can I use foreach or anything so it checks all the variables.
I tried:
$array = array($num1,$num2,$num3,$num4,$num5);
foreach($array as $nums){
if(ereg("([1-9]*)$",$nums)) {
echo "valid";
}
But it only checked the first variable. ($num1)