ID: 28760 Updated by: [EMAIL PROTECTED] Reported By: james at gogo dot co dot nz -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Linux PHP Version: 4.3.4 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. the output should really be: -5 5 if operator precedence is equal, left to right associativity is used. To obtain preferred precendence use (). Previous Comments: ------------------------------------------------------------------------ [2004-06-13 01:37:28] james at gogo dot co dot nz Description: ------------ In http://www.php.net/manual/en/language.operators.php the relative precedence of + - and . is listed as '+ - .' indicating that + and - operations should happen before . operations. However the code here shows that concatenation happens first. Personally I would prefer that concatenation happened last as in the docs as it would be much more sensible (you hardly ever want to use + - on a result of a concatenation, but often want to use the result of a + - in a concatenation), but that's obviously too big a change now. Reproduce code: --------------- echo 'Foo' . 5 - 5; echo "\n"; echo 'Foo' . 5 + 5; Expected result: ---------------- I expect to get the following --- Foo0 Foo10 --- (+ and - happen first, then concatenation, as according to documentation) Actual result: -------------- The result you get is --- 0 5 --- (. happens first, then the resulting string is evaluated as int producing 0 which is combined with the next operator and value to produce the result). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28760&edit=1