Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php ?:

// Example usage for: Ternary Operator
$action = $_POST['action'] ?: 'default';

// The above is identical to this if/else statement
if (empty($_POST['action'])) {
    $action = 'default';
} else {
    $action = $_POST['action'];
}
Source by abhinavsingh.com #
 
PREVIOUS NEXT
Tagged: #php
ADD COMMENT
Topic
Name
6+5 =