On the "Ask About PHP" blog today there's a new post looking at some of the alternative syntaxes that PHP has to offer for control structures.
PHP offers an alternative way to write their control structures for as long as Iâ€™ve remembered. It basically does away with the curly brackets and replaces the opening curly with a colon (:) and the closing with â€˜endâ€™-whatever. I have to be honest and say Iâ€™ve never really found a need to use the alternative syntax, simply because Iâ€™m so used to using the curly braces after so many years of using PHP. Plus, itâ€™s less typing!
The one specifically mentioned deals with "if" evaluations. There's two other options to the usual braces method - one being a shorthand using colons and a semicolon and the other using the ternary syntax.