我已经能够搜索一个多维数组,比如
Array
(
[0] => Array
(
[size] => 39
[colour] => N/A
[quantity] => 5
)
[1] => Array
(
[size] => 35
[colour] => N/A
[quantity] => 5
)
[2] => Array
(
[size] => 40
[colour] => N/A
[quantity] => 5
)
[3] => Array
(
[size] => 30
[colour] => N/A
[quantity] => 5
)
)
并返回匹配的匹配数组,如下所示
Array
(
[size] => 35
[colour] => N/A
[quantity] => 5
)
使用这个片段
$result = array();
foreach ($multi_array as $arr) {
if ($arr['size'] == $one_dimen_arr['size'] && $arr['colour'] == $one_dimen_arr['colour']) {
$result = $arr;
break;
}
}
是否可以从主多维数组中删除匹配项并替换为该位置的更新数组?