alandbh
4/20/2017 - 2:28 PM

Shorthand for IF / ELSE statement. (or ternary)

Shorthand for IF / ELSE statement. (or ternary)

/* echo, inline */
echo 'Based on your score, you are a ',($score > 10 ? 'genius' : 'nobody'); //harsh!

/* shorthand usage */
$message = 'Hello '.($user->get('first_name') ?: 'Guest');