php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21379 Add integer to pop and unshift
Submitted: 2003-01-02 22:10 UTC Modified: 2013-07-12 13:10 UTC
From: c dot greenNOSP at Mits dot uq dot edu dot au Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 4.3.0 OS: RH 7.3
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: c dot greenNOSP at Mits dot uq dot edu dot au
New email:
PHP Version: OS:

 

 [2003-01-02 22:10 UTC] c dot greenNOSP at Mits dot uq dot edu dot au
It would be nice if pop and unshift had an optional integer argument.  This would be useful for retreiving or removing the first or last n elements of an array.  

If the default is left as 1, then no current code will be affected, and the functions would be extended in an intuitive way.

Cheerio,

Cameron Green

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-12 13:10 UTC] maarten@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2013-07-12 13:10 UTC] maarten@php.net
array_slice() does what you want. :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC