"The ternary (?) operator is similar to the if statement, except that it returns a value drived from one of two expressions separated by a colon...If the test expression evaluates to true, the result of the second expression is returned; otherwise, the value of the third expression is returned." This form of expression may be difficult to read, but it works well with just two alternatives, and results in compact code.
SYNTAX: (expression) ? returned_if_expression_true : returned_if_expression_false;
$mood = "sad";
$text = ($mood == "happy") ? "I'm in a good mood!" : "I am in a $mood mood.";
echo $text;