how to push an element into the middle of an array
Posted: Thu Sep 08, 2005 4:21 am
Hi
I got the folllowing array:
$arr = {4, 9, 10, 3}
I would like to push the value 2 into the array so it would be the new 3rd element
The new final array will be:
$arr = {4, 9, 2, 10, 3}
Is there a simple PHP function that lets you dynamically add elements into a specific index in an array
and automatically shifts the trailing values?
I know that i can implement it myself, but I am looking for a built-in efficient method to do it
regards
I got the folllowing array:
$arr = {4, 9, 10, 3}
I would like to push the value 2 into the array so it would be the new 3rd element
The new final array will be:
$arr = {4, 9, 2, 10, 3}
Is there a simple PHP function that lets you dynamically add elements into a specific index in an array
and automatically shifts the trailing values?
I know that i can implement it myself, but I am looking for a built-in efficient method to do it
regards