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