ID: 34601 Updated by: [EMAIL PROTECTED] Reported By: steemann at globalpark dot de -Status: Wont fix +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux 2.4.21-99 PHP Version: 5.1.0RC1 New Comment:
In this case the behaviour is undefined and if it happen to work for you before, well.. you were lucky. But it's still undefined (as it is in such languages as C or C++). Previous Comments: ------------------------------------------------------------------------ [2005-09-22 17:06:24] [EMAIL PROTECTED] Although this is a BC break, you can never rely on this behavior in any computer language where you both *use* a variable and increment it. ------------------------------------------------------------------------ [2005-09-22 16:50:06] steemann at globalpark dot de Description: ------------ I noticed a slight change in the order some instructions get executed. The execution order of instructions for a code like $result[$base]=$base++; differs from PHP 5.1 to previous versions so that the $result variable also has different values as follows: PHP 4.3.10 : array(1) { [0]=> int(0) } PHP 5.0.3 : array(1) { [0]=> int(0) } PHP 5.1.0b3 : array(1) { [1]=> int(0) } PHP 5.1.0RC1 : array(1) { [1]=> int(0) } Reproduce code: --------------- $base=0; $result[$base]=$base++; var_dump($result); Expected result: ---------------- To keep compatibility with PHP 4.x and 5.0.x: array(1) { [0]=> int(0) } Actual result: -------------- array(1) { [1]=> int(0) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34601&edit=1