array_splice() 表示关联数组
假设我有一个关联数组:
array(
"color" => "red",
"taste" => "sweet",
"season" => "summer"
);
我想在其中引入一个新元素:
"texture" => "bumpy"
在第二项后面,但保留所有数组键:
array(
"color" => "red",
"taste" => "sweet",
"texture" => "bumpy",
"season" => "summer"
);
有没有一个功能可以做到这一点?array_splice()
不会剪切它,它只能使用数字键。