The Ternary Operator : Comparison Operators « Operator « PHP






The Ternary Operator

 
<?
 $age = 18;
 $agestr = ($age < 16) ? 'child' : 'adult';
?>
  
  








Related examples in the same category

1.Comparison Operators
2.Comparing numbers and strings
3.Loose Comparison Operators
4.Using Comparison Operators in if Statements
5.The equality operator
6.These values are compared using dictionary order
7.These values are compared using numeric order
8.Equality Operators summary table
9.Equality Operators in action