<?php
$list_programming_language = array('C#', 'C++', 'PHP', 'C#', 'PHP');
$result = array_unique($list_programming_language);
print_r($result);
?>
// ==> 'C#', 'C++', 'PHP'
<?php
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
?>
Array
(
[a] => green
[0] => red
[1] => blue
)
<?php
$fruits_list = array('Orange', 'Apple', ' Banana', 'Cherry', ' Banana');
$result = array_unique($fruits_list);
print_r($result);
?>
$array = array(1, 2, 2, 3);
$array = array_unique($array); // Array is now (1, 2, 3)
$str = count_chars($str,3);
$str = implode(',',array_unique(explode(',', $str)));