$arr=array('a','b','c','d','e','f','g');//目标数组bai
$i_arr=array('1','2');//要插入bai的数组
$n=2;//插入的位置
array_splice($arr,$n,0,$i_arr);
print_r($arr);
Array (
[0] => a
[1] => b
[2] => 1
[3] => 2
[4] => c
[5] => d
[6] => e
[7] => f
[8] => g
)
来源:https://zhidao.baidu.com/question/1930394207460712987.html
更多:https://www.php.net/manual/zh/function.array-splice.php