+ 2
What's the error in this code
<?php $num = 65; if ($num =<2) echo "Infant"; elseif ($num>2 and $num<5) { echo "Toddler"; } elseif ($num>5 and $num<12) { echo "Adolescent"; } elseif ($num>12 and $num<19) { echo "Teenager"; } else { echo "Adult" } ?>
4 Respostas
+ 4
1) '$num =< 2' ----> '$num <= 2'
2) after 'echo "adult"' you're missing a ';'
+ 5
line 3 : if ($num <= 3)
line 19: echo "adult" ;
in line 3 use <= instead of =<
in line 19 you missed the semicolon ( ; )
+ 1
Thanks. Problem solved.