php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #460 Incorrect description and example of each()
Submitted: 1998-06-15 10:28 UTC Modified: 1998-06-15 11:41 UTC
From: john at scl dot co dot uk Assigned:
Status: Closed Package: Documentation problem
PHP Version: 3.0 Release Candidate 5 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: john at scl dot co dot uk
New email:
PHP Version: OS:

 

 [1998-06-15 10:28 UTC] john at scl dot co dot uk
each

each -- return next key/value pair from an array

WRONG! it returns the current pair and advances the pointer

Description

array each(array array);

Returns the next key/value pair from the array array. This pair is returned in a four-element array, with the keys 0, 1, key, and value.
^DITTO
Elements 0 and key each contain the key name of the array element, and 1 and value contain the data.

Example 1. each() examples

$foo = array( "bob", "fred", "jussi", "jouni" );
$bar = each( $foo );


$bar now contains the following key/value pairs:

      0 => 0

      1 => 'bob'

      key => 0

      value => 'bob'

$foo = array( "Robert", => "Bob", "Seppo" => "Sepi" );
SYNTAX ERROR: remove , after "Robert"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-06-15 11:41 UTC] rasmus
Fixed - will be in next manual update
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 06:01:38 2025 UTC