(condition ? true : false);
<?php $strGender = "M"; $strGenderText = ""; if($strGender == "M") { $strGenderText = "Male"; } else { $strGenderText = "Female"; } echo "Your gender = ".$strGenderText; ?>
<?php $strGender = "M"; echo "Your gender = ".($strGender == "M" ? "Male" : "Female"); ?>
$is_admin = ($result['permissions'] == 'admin') ? true : false;
echo 'Welcome '.($user['is_logged_in'] ? $user['first_name'] : 'Guest').'!';
function getValue($arr) { return ( isset($arr[0]) ? $arr[0] : false); }
(condition1 ? true : (condition2 ? true : false));