note 76110 deleted from function.is-null by tularis

From: Date: Sat, 30 Jun 2007 23:19:16 +0000
Subject: note 76110 deleted from function.is-null by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-128117@lists.php.net to get a copy of this message
Note Submitter: Tim ---- Just a friendly note, people. The following is considered horrible code: <?php function myFunc () { if (foo || bar) { return true; } else { return false; } } ?> (or variations thereof) Instead, use the following syntax and you won't be the laughing stock of fellow developers: <?php function myFunc () { return (foo || bar); } ?> The reason this works is because the condition is already a boolean, and there is no reason not to return it. I've heard people argue that this is less readable, but those people were idiots, so deal with it.

« previous php.notes (#128117) next »