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
 [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

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 Aug 15 09:01:27 2024 UTC