How to remove duplicates from multidimensional array in php
- by JackTurky
i have an array like:
Array
(
[prom] => Array
(
[cab] => Array
(
[0] => Array
(
[code] => 01
[price1] => 1000
[price2] => 2000
[available] => 2
[max] => 2
[gca] => 2
)
[1] => Array
(
[code] => 04
[price1] => 870
[price2] => 2500
[available] => 3
[max] => 4
[gca] => 10
)
[2] => Array
(
[code] => 01
[price1] => 1000
[price2] => 2000
[available] => 2
[max] => 2
[gca] => 2
)
[3] => Array
(
[code] => 05
[price1] => 346
[price2] => 1022
[available] => 10
[max] => 2
[gca] => 20
)
)
[cab1] => Array........
)
[prom1] = Array....
)
What i have to do is to remove duplicates inside every [cab*] array..
so to have something like:
Array
(
[prom] => Array
(
[cab] => Array
(
[0] => Array
(
[code] => 01
[price1] => 1000
[price2] => 2000
[available] => 2
[max] => 2
[gca] => 2
)
[1] => Array
(
[code] => 04
[price1] => 870
[price2] => 2500
[available] => 3
[max] => 4
[gca] => 10
)
[2] => Array
(
[code] => 05
[price1] => 346
[price2] => 1022
[available] => 10
[max] => 2
[gca] => 20
)
)
[cab1] => Array........
)
[prom1] = Array....
)
In know that there is array_unique combined with array_map to remove duplicates.. but i know that it works only on 2D array.. what can i do? can someone help me pls? thanks!!!