|
|
Php Array Unique Function
|
Tutorials » Php »
|
Topic |
What is array_unique Function?
|
|
Explanation |
|
The "array_unique" function removes duplicate values from an array.
Syntax:
array_unique(array)
In the above syntax "array" is the array from which the duplicate values are removed.
Example:
<?php
$b=array("a"=>"Orange","b"=>"Guava","c"=>"Guava");
print_r(array_unique($b));
?>
Result:
Array ( [a]=> Orange [b]=> Guava );
In the above example the duplicate value "Guava" is removed and its displayed only once.
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|