PHP » Operators » ?:

Syntax:
expression1 ? expression2 : expression3
expression1
Deciding expression.
expression2
Expression returned if expression1 is TRUE.
expression3
Expression returned if expression1 is FALSE.

Ternary operator.

The ternary operator uses one expression to choose between two others. If expression1 evaluates to TRUE, the operator returns expression2. Otherwise expression3 is returned.

Examples

Code:
<?php

$mood = "indifferent";
print ($mood == "happy" ? "Yippie!" : "Oh, well");

?>
Output:
Oh, well
Explanation:

The ternary operator is used to pick a message to print.