I have an existing array, example:
Array
(
[0] => ABCD EFGH
[1] => 123456
[2] => 7890
)
Now I have an existing field with three values. I would need to split the array with the first value, ie Key [0], and update the existing array with new array values by inserting it at the beginning of the array. Desired output:
Array
(
[0] => ABCD
[1] => EFGH
[2] => 123456
[3] => 7890
)
i wanted to do an explode () of an existing array [0] explode(" ", $array[0]);
and the newly created two array using the function array_push();
But thearray_push();
function allows to update the original array by inserting a new value only at the end of the array.
Is there an easy way to do this? Or do I have to build a new array and extend it with new values by overwriting the entire array?
Thank you very much.