php - removing array duplicates from associative array -
so have:
array ( [animals] => array ( [0] => horse [1] => dog [2] => dog ) [team] => array ( [0] => cubs [1] => reds [2] => cubs ) )
trying eliminate repeat ones animals , same team.
tried didn't help.
$unique = array_map("unserialize", array_unique(array_map("serialize", $result)));
seems doesn't reach deep inside, don't want either hard code animals or team.
$data = [ 'animals' => ['horse', 'dog', 'dog'], 'team' => ['cubs', 'reds', 'cubs'] ]; $result = array_map('array_unique', $data); print_r($result);
Comments
Post a Comment