note 25063 deleted from control-structures by didou

From: Date: Mon, 04 Aug 2003 06:03:08 +0000
Subject: note 25063 deleted from control-structures by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53300@lists.php.net to get a copy of this message
Note Submitter: simon at blueshell.dk ---- [Editor's note: It would be better practice to use the ternary operator as argument for the "print" language construct, e.g.: print ($foo == $bar) ? "The match" : "They don't match"; Same approach can be used for assignment.] For short if-else's: if ($foo == $bar) { print "They match"; } else { print "They don't match"; } This can quickly be converted into: ($foo == $bar) ? print "They match" : print "They don't match"; This can be useful if the check's intention can be expressed in matter of a single function, like this.

« previous php.notes (#53300) next »