RE: [PHP] or return problem

From: Date: Wed, 08 Oct 2003 17:18:09 +0000
Subject: RE: [PHP] or return problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-165482@lists.php.net to get a copy of this message
--- "Ford, Mike [LSS]" <M.Ford@lmu.ac.uk> wrote: > No, it's not -- the misconception appears to be yours. Well, perhaps it is a difference in perspective. Yes, "or" and "||" can be exchanged: 1. if ($foo or $bar) blah(); 2. mysql_query($sql) || die(mysql_error()); My point was to differentiate the two examples above, regardless of format. A conditional means to me that there is a fork in the path. In example 1 above, the fork is whether blah() is to be executed or not, and what determines that is whether either $foo or $bar evaluate as true. In example 2, the fork is whether die(mysql_error()) happens, and what determines that is whether mysql_query($sql) evaluates as true (indicating the query was successful). I guess you could see two different forks in the path concerning example 1, because $bar is only evaluated if $foo is false. Either way, the primary point of the conditional expression is to determine whether blah() should be executed. So, you are right, but I think of things a bit differently. Chris ===== My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp

« previous php.general (#165482) next »