php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #3654 Code fragment has a bug
Submitted: 2000-02-28 13:30 UTC Modified: 2000-03-01 06:10 UTC
From: tibbetts at mit dot edu Assigned:
Status: Closed Package: Documentation problem
PHP Version: 3.0.15 OS:
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tibbetts at mit dot edu
New email:
PHP Version: OS:

 

 [2000-02-28 13:30 UTC] tibbetts at mit dot edu
http://www.php.net/manual/control-structures.continue.php3
the code fragment says:

while (list($key,$value) = each($arr)) {
  if ($key % 2) { // skip even members
    continue;
  }
  do_something_odd ($value);
}

which does *not* skip even member, it skips odd members. It should be changed to:

while (list($key,$value) = each($arr)) {
  if (!($key % 2)) { // skip even members
    continue;
  }
  do_sometihng_odd ($value);
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-03-01 06:10 UTC] hholzgra at cvs dot php dot net
fixed in latest phpdoc cvs
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 16 16:00:01 2026 UTC