The Ternary Operator

The Ternary Operator

  • It is called the ternary operator because it takes three operands
    • a condition
    • a result for true
    • and a result for false.
<?php
$agestr = ($age < 16) ? 'child' : 'adult';
?>

Comments