Doc #65087 [NEW]: There is a confusing comment in example

From: Date: Fri, 21 Jun 2013 15:02:01 +0000
Subject: Doc #65087 [NEW]: There is a confusing comment in example
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9962@lists.php.net to get a copy of this message
From: truenrush at gmail dot com Operating system: Any PHP version: 5.5.0 Package: Documentation problem Bug Type: Documentation Problem Bug description:There is a confusing comment in example Description: ------------ I would like to report about "Example #1 Associativity" on the following docs page, because it is very confusing: http://www.php.net/manual/en/language.operators.precedence.php 1. According to operators precedence table, "++" operator precedence is MUCH MORE higher then "+" one. As i understand, exactly pre-increment, because post- increment is always executed last one (table with precedence order is not correct, eh? do we need to separate pre-increments and post-increments there?) 2. According to http://www.php.net/manual/en/language.operators.increment.php page, there should be following scenario for your example: - $a variable is pre-incremented (becomes $a = 2) - sum is calculated for $a + $a variables (4 number will be printed by echo) - $a variable is post-incremented (becomes $a = 3) Test script: --------------- // mixing ++ and + produces undefined behavior - WTF? result should always be 4 $a = 1; echo ++$a + $a++; // may print 4 or 5 -- Edit bug report at https://bugs.php.net/bug.php?id=65087&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65087&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65087&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65087&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65087&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65087&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65087&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65087&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65087&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65087&r=support Expected behavior: https://bugs.php.net/fix.php?id=65087&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65087&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65087&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65087&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65087&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65087&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65087&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65087&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65087&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65087&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65087&r=mysqlcfg

« previous php.doc.bugs (#9962) next »