★ wanayoo — archive 1999 http://www.php.net/manual/function.array-unique.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Arrays
Quick Reference
Hungarian version of this page
Arrays
* array
* array_count_values
* array_diff
* array_flip
* array_intersect
* array_keys
* array_merge
* array_merge_recursive
* array_multisort
* array_pad
* array_pop
* array_push
* array_rand
* array_reverse
* array_shift
* array_slice
* array_splice
* array_unique
* array_unshift
* array_values
* array_walk
* arsort
* asort
* compact
* count
* current
* each
* end
* extract
* in_array
* key
* krsort
* ksort
* list
* next
* pos
* prev
* range
* reset
* rsort
* shuffle
* sizeof
* sort
* uasort
* uksort
* usort
Manual: array_unique
View the source code for this pageSearch the site



Previous page
 array_splice
 Updated
Wed, 09 Aug 2000
array_unshift 
Next page


array_unique

(PHP4 >= 4.0.1)

array_unique -- Removes duplicate values from an array

Description

array array_unique (array array)

Array_unique() takes input array and returns a new array without duplicate values. Note that keys are preserved.

Example 1. Array_unique() example


$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique ($input);
      

This makes $result have array ("a" => "green", "red", "blue");


User Contributed Notes: array_unique


pb@webfactory.de
13-Aug-2000 06:23
Actually array_unique() doesn't remove array elements, it just empties them. Maybe a bug!


 About Notes


Previous page
 array_splice
 Updated
Wed, 09 Aug 2000
array_unshift 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.