ID: 40820 Updated by: [EMAIL PROTECTED] Reported By: mturner at cc dot umanitoba dot ca -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: linux PHP Version: Irrelevant New Comment:
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. "Although = has a lower precedence than most other operators, ..." Previous Comments: ------------------------------------------------------------------------ [2007-03-15 12:57:29] mturner at cc dot umanitoba dot ca Description: ------------ According to the operator precdence docs, the modulus operator has precedence over the equals operator. But that is not in fact how it works, as a recent thread on the php general list has shown. Reproduce code: --------------- $s= 5; $d = 2; $result = ($s % $d=3); echo "3 incorrectly assigned to \$d: \$d=$d\n"; echo "result of mod = $result\n"; //$result here is 2: 5 % 3 Expected result: ---------------- This should give an error, instead it assigns 3 to $d and gives a result of 2. A parallel bug was reported with respect to the ! and the = operators in bug #17180, which resulted in a statement at the end of the operator precedence document which allows for an exception to the rule. Either the operator precedence rules should be respected or a general inquiry should be made into how php handles = and a general statement about it should be appended to the operator precedence docs. These exceptions to the operator precedence rules are not allowd in Perl. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40820&edit=1