PHP Shorthand If Notation or the Ternary Operator
Why should I care about PHP Shorthand If Notation or the Ternary Operator
Programming would be a bit useless without being able to evaluate conditions using if/end and switch statements. If/Else statements is obviously a great tool, but they aren’t optimal (or necessary) in all situations. And so I introduce you to … PHP Shorthand If Notation or the Ternary Operator.
Ternary operator takes the form “(condition) ? (true return value) : (false return value)” to shorten your if/else structures.
(more…)