Insert new row into middle of array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bugboy
    New Member
    • Sep 2007
    • 160

    Insert new row into middle of array

    I have an array which i want to insert a new value into the middle without losing any values. Is there an array function for this?

    Code:
    ARRAY(  [1]  =>  "a"  [2] =>  "c"   [3] =>  "d" )
    //I would like to insert "b" at key [2]..  creating this:
    ARRAY(  [1]  =>  "a"  [2] =>  "b"   [3] =>  "c"  [4] =>  "d" )
    Thanks!
  • bugboy
    New Member
    • Sep 2007
    • 160

    #2
    Oops, I've ask this before! Here is the answer:

    array_splice()



    Thanks!

    Comment

    Working...