Removes duplicate values from an array in PHP

Removes duplicate values from an array in PHP

array_unique function is helpful for this operation.

USAGE:

$arr = array("o" => "one", "two", "c" => "one", "one", "three");
print_r($arr); // array with duplicate values;

$arr_unique = array_unique($arr); // do the magic
print_r($result); // array with unique values;

Share this post

Leave a Reply


Select Your Currency
$