Есть массив товаров в корзине.
Если вывести массив получается вот что
Array (
[02db2e33f6361f61182f0226bff9796b] => Array ( [rowid] => 02db2e33f6361f61182f0226bff9796b [id] => 349 [qty] => 1 [price] => 14000 [name] => Dailies Total 1 [images] => e0cf9568ddbf6c809e4f79d13fdedadc.jpg [discount] => 0 [options] => Array ( [optical] => -01.00 [radius] => 8.5 [optical_power] => [os_grad] => [color] => ) [subtotal] => 14000 )
[0ac30b646b9d132a26080046573a91ee] => Array ( [rowid] => 0ac30b646b9d132a26080046573a91ee [id] => 349 [qty] => 1 [price] => 14000 [name] => Dailies Total 1 [images] => e0cf9568ddbf6c809e4f79d13fdedadc.jpg [discount] => 0 [options] => Array ( [optical] => -01.25 [radius] => 8.5 [optical_power] => [os_grad] => [color] => ) [subtotal] => 14000 )
[1482d85f3864ac22acea2a7b326d72a5] => Array ( [rowid] => 1482d85f3864ac22acea2a7b326d72a5 [id] => 13 [qty] => 1 [price] => 4580 [name] => ACUVUE 2 6шт. [images] => 00fe0b832ea22485b52523b853503682.jpeg [discount] => 0 [options] => Array ( [optical] => -00.50 [radius] => 8.3 [optical_power] => [os_grad] => [color] => ) [subtotal] => 4580 )
)
Тут три товара. У двух товаров поле id одинаковое. Мне нужно перебрать весь массив и если одинаковые id то присвоить поле discount=5.
Как сделать?