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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu May 02 20:01:31 2024 UTC