Result Size: 625 x 571
x
 
<!DOCTYPE html>
<html>
<body>
<?php
   // if empty($user) = TRUE, set $status = "anonymous"
   echo $status = (empty($user)) ? "anonymous" : "logged in";
   echo("<br>");
   $user = "John Doe";
   // if empty($user) = FALSE, set $status = "logged in"
   echo $status = (empty($user)) ? "anonymous" : "logged in";
?>  
</body>
<!-- Mirrored from www.w3schools.com/php/phptryit.asp?filename=tryphp_oper_ternary by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:29:31 GMT -->
</html>
×

Report a Problem: