Req #34360 [Opn->Wfx]: array_push with the new key as return value

From: Date: Thu, 08 Jan 2015 23:46:48 +0000
Subject: Req #34360 [Opn->Wfx]: array_push with the new key as return value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189789@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=34360&edit=1 ID: 34360 Updated by: ajf@php.net Reported by: yaxay at gmx dot net Summary: array_push with the new key as return value -Status: Open +Status: Wont fix Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: Irrelevant PHP Version: 5.0.4 Block user comment: N Private report: N New Comment: Unlikely to be changed. Previous Comments: ------------------------------------------------------------------------ [2005-09-03 14:59:22] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=34360&edit=1

« previous php.bugs (#189789) next »