ID: 35545
User updated by: kervala at jpopdb dot net
Reported By: kervala at jpopdb dot net
Status: Bogus
Bug Type: Variables related
Operating System: Linux 2.4
PHP Version: 5.1.1
New Comment:
Oops, sorry, tou didn't meant that's the code which was unknown but the
result...
However, I always knew that the 3rd parameter of "for" were
instructions and the return code wasn't used even if "$years[$i] =
$i--" should return $i in my case.
Previous Comments:
------------------------------------------------------------------------
[2005-12-04 13:38:42] kervala at jpopdb dot net
If $i is set to 200:
$years[$i] = $i--;
=> "$years[200] = 200;" not "$years[200] = 199;"
I don't see where the code is unknown... It's valid in all
languages...
By the way why this code always worked in previous versions if this is
unknown code ? ;p
I suppose it's a regression.
------------------------------------------------------------------------
[2005-12-04 13:14:57] [EMAIL PROTECTED]
The result of this code is unknown in all languages:
$years[$i] = $i--;
------------------------------------------------------------------------
[2005-12-04 13:04:47] kervala at jpopdb dot net
Description:
------------
For my site, I used a piece of code which always worked fine. (see
below)
It's a simple PHP code using a "for" loop and variables manipulation.
Reproduce code:
---------------
for($i=date("Y")+1; $i>=1970; $years[$i] = $i--);
print_r($years);
Expected result:
----------------
In all previous PHP versions, it returned :
2006 => 2006,
2005 => 2005,
etc...
Actual result:
--------------
It now returns :
2005 => 2006,
2004 => 2005,
etc...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35545&edit=1