Answers for "php shorthand"

PHP
1

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'
}
Posted by: Guest on January-07-2021
3

php ternary

$result = $condition ? 'foo' : 'bar';
Posted by: Guest on September-02-2020
3

shorthand if php

$is_admin = ($user['permissions'] == 'admin') ? true : false;
Posted by: Guest on May-15-2020
2

php ternary shorthand

$y = $x ? "true" : "false";
Posted by: Guest on May-25-2020
2

php if short form

<?php echo ($qte > 0) ? $qte : 0; ?>
Posted by: Guest on November-14-2020

Browse Popular Code Answers by Language