这里我有我的数组(****
只是字符串)
[m_timestamp] => ****
[n_id] => ****
[n_name] => ****
[n_material] => ****
[n_neck_finish] => ****
[n_weight] => ****
[n_height] => ****
[n_qty_p_ctn] => ****
[n_ctn_dimensions] => ****
[n_comment] => ****
[sha1] => ****
我如何插入另一个数组:
[n_group] => ****
[n_available] => ****
变成原来的样子:
[m_timestamp] => ****
[n_id] => ****
[n_name] => ****
[n_group] => **** //inserted
[n_available] => **** //inserted
[n_material] => ****
[n_neck_finish] => ****
[n_weight] => ****
[n_height] => ****
[n_qty_p_ctn] => ****
[n_ctn_dimensions] => ****
[n_comment] => ****
[sha1] => ****
我知道插入数组的关键值(在这种情况下n_name
:)
我做了什么:
$pos = intval(array_search("n_name", $myarray))+1;
array_splice($myarray, $pos, 0, $insertedarray);
但它没有$insertedarray
正确放置,它将它添加[0]=>null
到我指定的位置
我该如何解决这个问题?