php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4159 Wrong count array after unset()
Submitted: 2000-04-16 12:05 UTC Modified: 2002-09-30 18:18 UTC
From: cbob at builder dot cz Assigned:
Status: Not a bug Package: Other
PHP Version: 3.0 Latest CVS (16/04/2000) OS: Linux RH,
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cbob at builder dot cz
New email:
PHP Version: OS:

 

 [2000-04-16 12:05 UTC] cbob at builder dot cz
Test script:
------------
$x=array(1,2,3,4,5,6,7,8);

for($i=0; $i<count($x); $i++)
    echo $x[$i]."<br>\n";

unset($x[2]);
echo "<hr>";

for($i=0; $i<count($x); $i++)
    echo $x[$i]."<br>\n";

Output:
1
2
3
4
5
6
7
8
------------------------------------------------------------
1
2

4
5
6
7

but I thing, that it may be:
1
2
4
5
6
7
8
?????

It test it under:
PHP-3.0.12
and
PHP-4.0b1
and it is the same....

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-30 18:18 UTC] hholzgra@php.net
unsetting an array element doesn't renumber the element keys
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 09:01:32 2024 UTC