Re: PHP 4.0 Bug #4037 Updated: improper parsing of logical statements
| From: | Zak Greant | Date: | Tue, 15 Aug 2000 17:02:33 +0000 |
| Subject: | Re: PHP 4.0 Bug #4037 Updated: improper parsing of logical statements | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-29008@lists.php.net to get a copy of this message | ||
At 06:38 PM 8/15/00 +0200, Oded Arbel wrote:
OK, you are right - according to the manual, I should have used the logical operator 'and' instead of '&&' . I still think that this is wrong though, and misleading - high level programming languages always set the logical operators (no matter how they are named) as lower precedence then assignment operators (actually, the lowest),Hmmm... my reference books are at home, but I seem to remember that this is not the case for C or for Perl
and if you want a different behaviour then you use parenthesis.Parenthesis are almost always a good idea. They keep you from being dependant on quirks with compilers and help make your code more maintainable.
I'd hate to sound like a conformist or something, but this is damaging to people who start programming in PHP after doing a lot of high level programming in other languages. (and it was different in PHP3 ;-)A large base of PHP users come from perl and C.
Oded P.S. sorry this is going by email - I can't remember my password to the PHP bug database. I hope you won't get mad at me.No worries :) - Zak