phparraysfilterduplicates

Remove duplicated values from an array


I have an array with some value like this:

[Organization_id] => Array
  (
     [0] => 4
     [1] => 4
     [2] => 4
  )

but i want some thing like this:

[Organization_id] => Array
  (
     [0] => 4
  )

Thanks in advance..


Solution

  • If you don't care about the key to value association possibly messing up, you can use this:

    $array = array_unique($array);