Using the ? operator to create a message : Operator Precedence « Operator « PHP






Using the ? operator to create a message

 
<?php
$logged_in = TRUE;
$user = "Admin";
$banner = ($logged_in==TRUE)?"Welcome back, $user!":"Please login.";

echo "$banner";
?>
  
  








Related examples in the same category

1.Operator Precedence
2.Operator Precedence summary table
3.Operators, precedence, and their associativity
4.Using the ? Operator