Answers for "how do php inline if statements work"

PHP
6

php inline if

/* most basic usage */
$var = 5;
$var_is_greater_than_two = ($var > 2 ? true : false); // returns true
Posted by: Guest on January-28-2020
3

shorthand if php

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

Browse Popular Code Answers by Language