php - Filter 2 dimensional array -


i have array looks bit this

array(     [0] => array(         ['id'] => 29         ['name'] => john         )     [1] => array(         ['id'] => 30         ['name'] => joe         )      [2] => array(         ['id'] => 29         ['name'] => jake         )  ) 

and goes on while.

i've found question elsewhere (here) , (here) neither works.

with first 1 following array

array(     [0] => 29     [1] => jake ) 

and te second 1 filters out exact duplicates , not duplicates jus same id.

i want duplicates same id removed array, how do that?

$filteredusers = []; foreach ($users $user) {     $filteredusers[$user['id']] = $user; }  // optionally: // $filteredusers = array_values($filteredusers); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -