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

PHP Home Page

Manual Table of Contents
Up to Arrays
Quick Reference
Japanese version of this pageHungarian 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_diff
View the source code for this pageSearch the site



Previous page
 array_count_values
 Updated
Wed, 09 Aug 2000
array_flip 
Next page


array_diff

(PHP4 >= 4.0.1)

array_diff -- Computes the difference of arrays

Description

array array_diff (array array1, array array2 [, array ...])

Array_diff() returns an array containing all the values of array1 that are not present in any of the other arguments. Note that keys are preserved.

Example 1. Array_diff() example


$array1 = array ("a" => "green", "red", "blue");
$array2 = array ("b" => "green", "yellow", "red");
$result = array_diff ($array1, $array2);
      

This makes $result have array ("blue");

See also array_intersect().


 About Notes


Previous page
 array_count_values
 Updated
Wed, 09 Aug 2000
array_flip 
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.