我想檢測相同的記錄,然後更改一條記錄的數量並刪除其他記錄。例如,假設下面的數組:PHP在數組中找到相同的記錄
'Cart' => [
(int) 0 => [
'size' => '38',
'code' => '5',
'qn' => (int) 1
],
(int) 1 => [
'size' => '37',
'code' => '5',
'qn' => (int) 1
],
(int) 2 => [
'size' => '37',
'code' => '5',
'qn' => (int) 1
]
],
我想打印:
'Cart' => [
(int) 0 => [
'size' => '38',
'code' => '5',
'qn' => (int) 1
],
(int) 1 => [
'size' => '37',
'code' => '5',
'qn' => (int) 2
]
],
Array_unique將刪除重複的數據。我需要統計有多少記錄和更新數量。看看,在secod數組更改中qn。 –