note 51913 deleted from control-structures.alternative-syntax by nlopess

From: Date: Thu, 05 May 2005 16:39:55 +0000
Subject: note 51913 deleted from control-structures.alternative-syntax by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-88971@lists.php.net to get a copy of this message
Note Submitter: peter at randomnity dot com ---- jasperbg at gmail dot com, if you are doing a quick, small comparison, the ternary operator *is* an alternative to using if...else <?php // eg... $x = 1; // long way... if($x == 1) { echo 'X is one!'; } else { echo 'X isn't one!'; } // ternary way echo (($x == 1) ? 'X is one!' : 'X isn't one!'); ?> it can save on line space... and help to compact code :)

« previous php.notes (#88971) next »