PHP array_unique() Function
Complete PHP Array Reference
Definition and Usage
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
| Parameter |
Description |
| array |
Required. Specifying an array |
Tips and Notes
Note: The returned array will keep the first array item's key
type.
Example
<?php
$a=array("a"=>"Cat","b"=>"Dog","c"=>"Cat");
print_r(array_unique($a));
?>
|
The output of the code above will be:
Array ( [a] => Cat [b] => Dog )
|
Complete PHP Array Reference
NEW! Altova MissionKit 2007– Save ½ off Intelligent tools for XML developers & software architects
 | |
The Altova MissionKit 2007
bundles Altova’s application development, data management and
modeling tools at 50% off their regular prices. It is available in a
variety of configurations tailored to meet the needs of software
architects and XML developers. All MissionKits include the
world’s leading XML development tools: Altova
XMLSpy,
MapForce,
and StyleVision.
Gear
up; download a FREE 30-day trial today!
|
|