In looking at my Google Analytics statistics, I see a lot of visitors searching for PHP shorthand if/else (ternary) information. I’ve gone through my code library and picked out some examples of ternary operator usage.
Tag Archives: sortif
Short If-Else Structure
In addition to the enlarged if – else statement that you will use in most cases, there is also a short structure for an if – else statement. This format uses the so-called “ternary operator ‘. The syntax of this shorthand structure is as follows: