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
 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri Jan 03 07:01:28 2025 UTC