--- "Ford, Mike [LSS]" <[EMAIL PROTECTED]>" <[EMAIL PROTECTED]> wrote: > Firstly, "or", as a Boolean operator requires two operands, both of > which must have an actual value.
[snip] > statements don't have a value (and can't even be coerced to have > one), so "return" can't be valid as one of the operands to "or". Based on yesterday's discussion, this seems to be a very common misconception. I will try to clear it up. Let's take a common use: mysql_query($sql) or die(mysql_error()); There is a conditional here, but it has nothing to do with the die() part. The "or" is not the same as "||" in a conditional expression. The return of die() is not being evaluated. Only the return of mysql_query() is. This can be rewritten as follows: if (!mysql_query($sql)) { die(mysql_error()); } If it helps, you can possibly replace "or" with "else" when you read these types of statements to clarify the use. It makes sense to me like it is. This really just boils down to language semantics, and it probably makes more sense to native English speakers than others. The word "or" means different things in the following two examples: 1. If you find some Coke or Pepsi, buy some. This suggests that either Coke or Pepsi will suffice. In PHP: if ($type == 'coke' || $type == 'pepsi') { buy_some(); } 2. Bring me the antidote, or I will die. This suggests that if the antidote is not brought, the speaker will die. If it is, the "or I will die" part never happens. In PHP: bring_antidote() or die; Of course, die is just an alias for exit, but it sounds better. :-) Hope that helps. Chris ===== My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php