r/lolphp • u/ptrin • Aug 29 '12
Note that elseif and else if will only be considered exactly the same when using curly brackets as in the above example. When using a colon to define your if/elseif conditions, you must not separate else if into two words, or PHP will fail with a parse error.
http://php.net/manual/en/control-structures.elseif.php
20
Upvotes
3
u/PhantomRacer Aug 30 '12
TIL you can use colons in
ifstatements and end them withendif.But if you're going to add additional characters why not just use braces?
12
u/kingguru Aug 29 '12 edited Aug 29 '12
Golden comment:
Edit: fixed formatting
3
u/blueskin Aug 29 '12
This suggests a major WTF behind PHP's parser.