note 19515 deleted from language.operators.logical by colder
| From: | colder@php.net | Date: | Fri, 20 Apr 2007 15:38:36 +0000 |
| Subject: | note 19515 deleted from language.operators.logical by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125695@lists.php.net to get a copy of this message | ||
Note Submitter:
----
The post of 14-Oct-1999 04:09 about operator precedence is incorrect.
When I run the second example
$choice1 = "";
$choice2 = "dog";
$default = "other";
$val = $choice1 or $choice2 or $default;
Then $val is "", since the expression is equivilent to
($val = $choice1) or $choice2 or $default;
To get $val to be "dog" use:
$val=$choice1 or $val=$choice2 or $val=$default;
which is equivilent to
($val=$choice1) or ($val=$choice2) or ($val=$default);