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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -