我有多维数组。
以下代码给出了我想要的结果,但是通过使用其索引[0]仅返回一个数组。该代码来自Removing an outer array:
$new_array = $outer_array[0];
$new_array = reset($out_arr);
这是我的多维数组
$old_array = Array
(
[0] => Array
(
[taxonomy] => updatable-category
[field] => term_id
[terms] => Array
(
[0] => 136
[1] => 134
[2] => 135
)
[operator] => IN
)
[1] => Array
(
[taxonomy] => apps-category
[field] => term_id
[terms] => Array
(
[0] => 126
[1] => 124
[2] => 125
)
[operator] => IN
)
);
以下为必填结果。注意:这里返回的数组必须用逗号分隔
$new_array = Array
(
[taxonomy] => updatable-category
[field] => term_id
[terms] => Array
(
[0] => 136
[1] => 134
[2] => 135
)
[operator] => IN
)
,
Array
(
[taxonomy] => apps-category
[field] => term_id
[terms] => Array
(
[0] => 126
[1] => 124
[2] => 125
)
[operator] => IN
);