Using the ? Operator
<html> <head> <title>Using the ? Operator</title> </head> <body> <?php $mood = "sad"; $text = ( $mood=="happy" ) ? "a good mood" : "Not happy but $mood"; print "$text"; ?> </body> </html>