Removes duplicate values from an array

by sabitha 2012-06-05 14:20:33

Removes duplicate values from an array



array_unique - This function removes duplicate values from an array

$myarr = array("apple", "orange", "banana", "orange");
$res = array_unique($myarr);
print_r($res);

will outputs
Array
(
[a] => apple
[0] => orange
[1] => banana
)

Tagged in:

402
like
0
dislike
0
mail
flag

You must LOGIN to add comments