How can I insert a new object in an array in a position, for example in the middle of the array?
You can find it a bit more intuitive. For this, only one function call is needed:
$ root = array ('a', 'b', 'c', 'd', 'e'); $ Inserted = array ('x'); // Not necessarily an array array_splice ($ origin, 3, 0, $ inserted); // BOLIVIS IN POSITION 3 // $ NOW IN A B C X DAY
Comments
Post a Comment