php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32196 Operator Precedence
Submitted: 2005-03-05 02:01 UTC Modified: 2005-03-05 09:48 UTC
From: the_deppchef at hotmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4CVS-2005-03-05 (stable) OS: Linux 2.4.27 (Debian)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: the_deppchef at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-03-05 02:01 UTC] the_deppchef at hotmail dot com
Description:
------------
Operator Precedence doesn't seem to work as in earlier versions/expected.
Following http://de.php.net/manual/en/language.operators.php#language.operators.precedence
&& should have a higher priority than "or" and || should have a higher priority than "and".
It doesn't work anymore..

Reproduce code:
---------------
<?php
$foo1=1;
$foo2=1;
$foo3=0;
if($foo1==0 && $foo2==0 or $foo3==0){
	echo '<br>This should not happen';
}else{
	echo '<br>This should happen';
}
$bar1=0;
$bar2=1;
$bar3=1;
if($bar1==0 || $bar2==0 and $bar3==0){
	echo '<br>This should happen';
}else{
	echo '<br>This should not happen';
}
?>

Expected result:
----------------
This should happen
This should happen

Actual result:
--------------
This should not happen
This should not happen

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-05 02:06 UTC] the_deppchef at hotmail dot com
Uhm, sorry, my fault :(

Did this change recently? I really had it in mind the other way round :(
 [2005-03-05 09:48 UTC] tony2001@php.net
No bug -> bogus.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 21 11:00:02 2025 UTC