Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php ternary operators

// Both ternary and if/else returns the same result

// ternary
$result = $condition ? 'foo' : 'bar';

// if/else
if ($condition) {
    $result = 'foo' 
} else {
    $result = 'bar'
}
Source by stitcher.io #
 
PREVIOUS NEXT
Tagged: #php #ternary #operators
ADD COMMENT
Topic
Name
8+1 =