note 8002 added to Logical Operators

From: Date: Wed, 23 Aug 2000 20:37:29 +0000
Subject: note 8002 added to Logical Operators
Groups: php.notes 
Request: Send a blank email to php-notes+get-3038@lists.php.net to get a copy of this message
The OR operator can be used to roughly imitate the behavior of an IF statement. For example: is_array ($variable) OR die ("$variable is not an array"); This works because PHP uses lazy (aka short-circuit) evaluation for the OR logical operator. If the expression on the left side of OR evaluates to TRUE, then PHP does not need to evaluate the expression on the right of OR to determine that at one of the expressions is true. However, if the left side is false, then PHP must try to find if the right side of the expression is true or false. http://www.php.net/manual/language.operators.logical.php

« previous php.notes (#3038) next »