Array_splice ()
$arr = Array (' A ', ' B ', ' C ');
$arr 2 = ' abc ';
$t = Array_splice ($arr, 1, 0, $arr 2);
Print_r ($arr);
Console output:
Array ([0] = ' A ' [1] = ' abc ' [2] = ' B ' [3] = ' C ');
A brief introduction to the Array_splice method, parameter one is an array of operations, parameter two is the index value of the operation element, parameter three is the length, parameter four is to replace the element.
The effect of this method is to delete the coherent element with 1 as the starting position, length 0 in $arr, and then fill it with $ARR2.
Tips: If the length is 0, then the effect is equivalent to inserting the specified element at the specified index value.
------------------------------------------------------------Gorgeous split Line Oo00o0ooo0oo ... ---------------------__________________________
The top array_splice is the pig's foot,
Array_push
Array_push--presses one or more cells into the end of the array (into the stack)
Description int
Array_push(array &array, mixed var [, mixed ...])
Array_push () will be array treated as a stack, and the incoming variable will be pressed into array the end. arraywill increase depending on the number of variables in the stack. The effect is the same as the following:
Inserting values anywhere in the PHP array