php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15562 New additions to the array family "array_insert"
Submitted: 2002-02-14 22:50 UTC Modified: 2002-02-15 00:34 UTC
From: jrhardy2002 at yahoo dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.1.1 OS: Linux
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: jrhardy2002 at yahoo dot com
New email:
PHP Version: OS:

 

 [2002-02-14 22:50 UTC] jrhardy2002 at yahoo dot com
I believe it would be a very handy feature to have an "array_insert" function (with re-key'ing).  I am in need of such an item and thus my request.  

What I mean by this is if I already have an array with numerical keys, and elements filled in, I would like to be able to insert an element into this pre-existing array.  So if I had 10 elements in my array, all with a key index.  I have a new element that I want to insert into this array, without popping off the end or from the top...I want it in a specific spot in the array.  So I have "newelement" which I want in key5, so I would "array_insert(key(5),newelement)" which would insert it at the appropriate spot without deleting anything there, and "newelement" would now have the key "key5" and the old key5 would now just be key6 and so on, so that I know have 11 elements with numerical keys.

Thanks
John

If that is not clear, please write me and I'll make it more clear.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-15 00:34 UTC] sniper@php.net
per request..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 18:01:31 2024 UTC