php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53886 Example is wrong
Submitted: 2011-01-31 03:56 UTC Modified: 2011-01-31 21:29 UTC
From: corrie at sloot dot ca Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant 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: corrie at sloot dot ca
New email:
PHP Version: OS:

 

 [2011-01-31 03:56 UTC] corrie at sloot dot ca
Description:
------------
---
From manual page: http://www.php.net/function.array-shift#Examples
---
$stack = array("orange", "banana", "apple", "raspberry");
$fruit = array_shift($stack);
print_r($stack);

the last line should be:

print_r($fruit);

otherwise "orange" would also be shown




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-31 11:33 UTC] rquadling@php.net
-Status: Open +Status: Bogus
 [2011-01-31 11:33 UTC] rquadling@php.net
array_shift() will remove the first entry from $stack. "orange" is assigned to $fruit.
 [2011-01-31 21:29 UTC] corrie at sloot dot ca
My bad.  Please ignore.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 20:01:36 2025 UTC