PHP Programing language

array_unique() Function in PHP
Previous Home Next

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

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: