0

what is the missing syntax in my codes that will make my codes run in alternative way rather than in curly brace syntax ?

!DOCTYPE html> <html> <head> <title></title> </head> <body> <?php $i = 5; switch ($i) { case 0: echo '$i is 0.'; break; case 1: case 2: case 3: case 4: case 5: echo '$i is somewhere between 1 and 5.'; break; case 6: case 7: echo '$i is either 6 or 7.'; break; default: echo "I don't know how much \$i is."; } ?> </body> </html>

16th Jul 2017, 4:40 AM
Patrick Estaron Magayon
Patrick Estaron Magayon - avatar
2 Answers
+ 4
The curly braces are anchors to define where things begin and where they end, why should you be concerned about those braces? Anyway, did you notice your code started with: !DOCTYPE html> instead of: <!DOCTYPE html>
16th Jul 2017, 5:29 AM
Ipang
+ 3
For future ference, when posting about code, please make the code and then insert it into the question, it is much more effecient, and the reason they allow you to do it.
16th Jul 2017, 5:00 AM
PiGuy Harris
PiGuy Harris - avatar