php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34360 array_push with the new key as return value
Submitted: 2005-09-03 14:59 UTC Modified: 2015-01-08 23:46 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:2 of 3 (66.7%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: yaxay at gmx dot net Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.0.4 OS: Irrelevant
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: yaxay at gmx dot net
New email:
PHP Version: OS:

 

 [2005-09-03 14:59 UTC] yaxay at gmx dot net
Description:
------------
The function array_push returns the count of the array after the new element/s is/are pushed onto it. However it would be rather useful to have the key of the first pushed value returned. Until now I have to rely on a rather slow user function to do the same.
Of course it makes no sense to modify the function, because some may need it to return the element count. However I think it would be very handy to be able to access the elements after pushing them onto the stack, therefore I wonder whether you could create a built in function to do so.

PS: I was not allowed to pick irrelevant for PHP version, so I picked 5.0.4 since I'm currently developing for PHP5 only. The funtion would be great for PHP4 too, though.
PPS: I hope I did not overlook an already existing function..

Sincerely,
Benjamin Schulz


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 23:46 UTC] ajf@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2015-01-08 23:46 UTC] ajf@php.net
Unlikely to be changed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 10:01:31 2024 UTC