php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15357 Manual entry for array_shift() incorrect
Submitted: 2002-02-03 12:01 UTC Modified: 2002-07-31 17:58 UTC
From: manuzhai at xavamedia dot nl Assigned:
Status: Closed Package: Arrays related
PHP Version: PHP4-CVS OS: Win XP, Compaq Tru64
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: manuzhai at xavamedia dot nl
New email:
PHP Version: OS:

 

 [2002-02-03 12:01 UTC] manuzhai at xavamedia dot nl
In the manual entry for array_shift(), this is stated: "This would result in $fruit having 3 elements left:". But it seems that this should be "This would result in $stack having 3 elements left:".

BTW: I'm not sure if I should report this kind of problems to this bug database, but I couldn't think of another way.

Manuzhai

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-03 12:56 UTC] philip@php.net
Thank you for this report, this has been fixed in CVS and will show up soon.
 [2002-07-31 04:38 UTC] nohn@php.net
Reopened this bug.

Manual says: 

$stack = array ("orange", "banana", "apple", "raspberry");
$fruit = array_shift ($stack);

Will result in $stack beeing:

Array
(
    [0] => banana
    [1] => apple
    [2] => raspberry
)
and orange will be assigned to $fruit. 

In fact Array is:

(
    [1] => banana
    [2] => apple
    [3] => raspberry
)

Don't know if this behaviour is expected and if it's a documentation bug or if this feature is not expected and it's a real bug.
 [2002-07-31 17:58 UTC] sniper@php.net
Sebastian, the manual is correct. Update your CVS checkout. Brad's patch for the array_shift() broke the behaviour and this is now reverted.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 15:01:27 2024 UTC