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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 01 01:01:28 2024 UTC