array_unique

(PHP 4 >= 4.0.1)

array_unique -- Removes duplicate values from an array

Description

array array_unique (array array)

Array_unique() takes input array and returns a new array without duplicate values. Note that keys are preserved.

Example 1. Array_unique() example


$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique ($input);
      

This makes $result have array ("a" => "green", "red", "blue");.