05-18-2009, 05:27 PM
|
#13 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
It may be worth adding that we can nest ternary operators.
It begins to get truly messy when you do this, and that's really when you should begin considering an if statement instead.
However:
php Code:
$szGender = 'M'; //$szGender = 'F';//$szGender = '';printf( 'Gender: %s', ( ! $szGender ? 'Unknown' : ($szGender == 'M' ? 'Male' : 'Female') ));
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|