I have a multidimensional array that I need to sort with uniqueness, since I have duplicate entries, so I need array_unique to go through the array and remove duplicates by value, for example.
Array ( [0] => Array ( [id] => 324 [time_start] => 1301612580 [level] => 0.002 [input_level] => 0.002 ) [1] => Array ( [id] => 325 [time_start] => 1301612580 [level] => 0.002 [input_level] => 0.002 ) [2] => Array ( [id] => 326 [time_start] => 1301612580 [level] => 0.002 [input_level] => 0.002 ) )
There are duplicates of time_start , which they are all the same, also level and input_level , but they should not be affected, only if there is a corresponding time_start , it should delete it and process the entire array (the array is larger than you think, but I just posted a small example of the array ) You should remove the cheats and return as follows:
Array ( [0] => Array ( [id] => 324 [time_start] => 1301612580 [level] => 0.002 [input_level] => 0.002 ) )
Questions I found that do not work:
- reformat multidimensional array based on value
- Remove item from multidimensional array based on value
arrays php multidimensional-array
Macmac
source share