array_unique

Syntax:array array_unique ( array $array [, int $sort_flags = SORT_STRING ] )
Description:Removes duplicate values from an array

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

OUTPUT

Array ( 
[a] => green 
[0] => red 
[1] => blue 
)

 

Leave a Reply

Your email address will not be published. Required fields are marked *