php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #519 next() returning false on end of array
Submitted: 1998-07-08 06:33 UTC Modified: 1998-07-08 08:25 UTC
From: kk at shonline dot de Assigned:
Status: Closed Package: Performance problem
PHP Version: 3.0 Final Release OS: Solaris 2.5.1
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: kk at shonline dot de
New email:
PHP Version: OS:

 

 [1998-07-08 06:33 UTC] kk at shonline dot de
According to the documentation and according to my experiments, next() "returns the array element in the next place that's pointed by the internal array pointer, or false if there are no more elements".

Unfortunately, the array element returned by next() may be false or the empty string. It is undecideable, if this is an  array end or an array element, making next() somewhat useless.

Perhaps a real bottom symbol (like perl's "undef") would be appropriate.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-07-08 08:25 UTC] ssb
If you want to traverse an array like this, use the each()
function.  There is an example in the FAQ.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC