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'];

?>

Documentation

See also Ternary Operator in PHP | How to use the PHP Ternary Operator

Related : Short Ternary Operator, Short Ternary Operator, Coalesce Operator

Added in PHP 7.0+