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 https://www.codementor.io/@sayantinideb/ternary-operator-in-php-how-to-use-the-php-ternary-operator-x0ubd3po6

Related : Short Ternary Operator, Short Ternary Operator, Coalesce Operator, If Then Else, Binary Operator, Colon, Operand, Unary Operator

Added in PHP 7.0+