Short Ternary Operator¶
The expression (expr1) ?: (expr3)
evaluates to expr2
if expr1
evaluates to empty(), and expr3
if expr1
evaluates to false.
Is is a short version of the ternary operator, and it is often used to set default values in a concise way.
<?php
$action = (empty($_POST['action'])) ? 'default';
?>
See also Short Hand Comparison in PHP
Related : Ternary Operator, Coalesce Operator
Added in PHP 5.3+