PHP Programing language

adplus-dvertising
array_unique() Function in PHP
Previous Home Next
adplus-dvertising

array_unique()

The array_unique() function removes duplicate values from an array. If two or more array values are the same, the first appearance will be kept and the other will be removed.

Syntax:
array_unique(array)

In above syntax, "array" specifying an array.

Example:

<?php
$a=array("a"=>"Apple","b"=>"Mango","c"=>"Apple");
print_r(array_unique($a));
?>

Output:

Array ( [a] => Apple [b] => Mango )

Previous Home Next