It is necessary to check if $arItem['ID'] in the two-dimensional $arBasketItems .
- Well, what exactly is causing you trouble? - Kromster
- bad php knowledge, didn’t find the right one, but I ’m not able to write a function to search for - Ivan Bubliy
- oneDo you have at least some assumptions, how to go through a two-dimensional array, how to compare elements? Have you tried to look at the "similar" questions and answers that the site offered you in the panel on the right? - Kromster
- Yes, I understand that here you probably need to use the foreach loop - Ivan Bubliy
|
1 answer
You can use foreach, you can use for, while, while / do, it will be the simplest and most readable solution.
You can also use array_walk or array_map to solve this problem in a functional style.
But I would recommend you to use recursive functions in order not to bother with the nesting of the array.
|