php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20028 foreach() escape's 0=>0 entry of an array.
Submitted: 2002-10-22 10:14 UTC Modified: 2002-10-22 10:41 UTC
From: daarius at hotmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.2.2 OS: Win32
Private report: No CVE-ID: None
 [2002-10-22 10:14 UTC] daarius at hotmail dot com
$a = array(0=>0, 1=>1);

foreach ($a as $key => $val) {
   print "key: ".$key.", val: ".$val;
}

above, the 0=>0 entry is simply skipped, and the itteration starts from 1. (it skips the 0 key OR value either string or integer.)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-22 10:41 UTC] sniper@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 10:00:01 2026 UTC