1--TEST-- 2Test array_diff_assoc() function : usage variations - array containing duplicate keys and values 3--FILE-- 4<?php 5/* 6 * Test how array_diff_assoc() behaves when comparing: 7 * 1. the order of the array 8 * 2. duplicate values 9 * 3. duplicate key names 10 */ 11 12echo "*** Testing array_diff_assoc() : variation ***\n"; 13 14$array_index = array('a', 'b', 'c', 0 => 'd', 'b'); //duplicate key (0), duplicate value (b) 15$array_assoc = array ('2' => 'c', //same key=>value pair, different order 16 '1' => 'b', 17 '0' => 'a', 18 'b' => '3', //key and value from array_index swapped 19 'c' => 2); //same as above, using integer 20 21var_dump(array_diff_assoc($array_index, $array_assoc)); 22var_dump(array_diff_assoc($array_assoc, $array_index)); 23 24echo "Done"; 25?> 26--EXPECT-- 27*** Testing array_diff_assoc() : variation *** 28array(2) { 29 [0]=> 30 string(1) "d" 31 [3]=> 32 string(1) "b" 33} 34array(3) { 35 [0]=> 36 string(1) "a" 37 ["b"]=> 38 string(1) "3" 39 ["c"]=> 40 int(2) 41} 42Done 43