php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25878 Different behaviour with array indexing by using the '++' incremental operator
Submitted: 2003-10-15 07:52 UTC Modified: 2003-10-15 18:20 UTC
From: cochius at advantic dot de Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.3.2 OS: W2k / Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cochius at advantic dot de
New email:
PHP Version: OS:

 

 [2003-10-15 07:52 UTC] cochius at advantic dot de
Description:
------------
There's different behaviour in PHP Version 4.1.2 and Version 4.3.2 when using the '++' incremental operator with the indexing variable.
Examine the example and it's different output, it's self-describing...


Reproduce code:
---------------
$r = array('val_1','val_2');
$j = 0;
while (isset($r[$j])) {
    $temp_arr[$j] = $r[$j++];
}
print_r($temp_arr);


Expected result:
----------------
PHP Version 4.1.2
-----------------

Array
(
    [0] => val_1
    [1] => val_2
)


Actual result:
--------------
PHP Version 4.3.2
-----------------

Array
(
    [1] => val_1
    [2] => val_2
)



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-15 18:20 UTC] sniper@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

..
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 01:01:35 2024 UTC