Ternary Operator¶
The expression (expr1) ? (expr2) : (expr3) evaluates to expr2 if expr1 evaluates to true, and expr3 if expr1 evaluates to false.
<?php
$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];
?>
Related : Short Ternary Operator, Short Ternary Operator, Coalesce Operator, If Then Else, Binary Operator, Colon, Operand, Unary Operator
Added in PHP 7.0+