note 56647 added to language.operators.logical

From: Date: Sun, 11 Sep 2005 00:04:06 +0000
Subject: note 56647 added to language.operators.logical
Groups: php.notes 
Request: Send a blank email to php-notes+get-95000@lists.php.net to get a copy of this message
Because the OR shorthand for an if block can produce more readable code with less typing, it is tempting to produce functions that will return FALSE on failure or some other data type on success. Like mysql_connect, which "Returns a MySQL link identifier on success, or FALSE on failure." The novice php php developer should avoid creating functions which might produce a FALSE on failure and an integer on success, if there is any chance that the integer might be zero. <?php blah blah blah; $i = give_me_liberty() or die("FATAL DB ERROR!"); blah blah blah; ?> ---- Manual Page -- http://www.php.net/manual/en/language.operators.logical.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56647 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56647&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56647&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56647&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56647&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56647&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56647&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56647&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95000) next »