Last Updated: February 25, 2016
·
957
· wajatimur

PHP Ternary Operator (IF/ELSE)

Using ternary operator or shorthand for if/else in PHP will save you lot of time and code line.

echo ($status == ‘sleep’ ? ‘Wake Up!’ : ‘Time to Work!’);