1--TEST-- 2Test array_diff_ukey() function : usage variation - Passing integer indexed array 3--FILE-- 4<?php 5/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func) 6 * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments. 7 * Source code: ext/standard/array.c 8 */ 9 10echo "*** Testing array_diff_ukey() : usage variation ***\n"; 11 12// Initialise function arguments not being substituted (if any) 13$input_array = array(-07 => '-07', 0xA => '0xA'); 14 15$input_arrays = array( 16 'decimal indexed' => array(10 => '10', '-17' => '-17'), 17 'octal indexed' => array(-011 => '-011', 012 => '012'), 18 'hexa indexed' => array(0x12 => '0x12', -0x7 => '-0x7', ), 19); 20 21function key_compare_func($key1, $key2) 22{ 23 return strcasecmp($key1, $key2); 24} 25 26foreach($input_arrays as $key =>$value) { 27 echo "\n--$key--\n"; 28 var_dump( array_diff_ukey($value, $input_array, 'key_compare_func') ); 29 var_dump( array_diff_ukey($input_array, $value, 'key_compare_func') ); 30} 31?> 32===DONE=== 33--EXPECTF-- 34*** Testing array_diff_ukey() : usage variation *** 35 36--decimal indexed-- 37array(1) { 38 [-17]=> 39 string(3) "-17" 40} 41array(1) { 42 [-7]=> 43 string(3) "-07" 44} 45 46--octal indexed-- 47array(1) { 48 [-9]=> 49 string(4) "-011" 50} 51array(1) { 52 [-7]=> 53 string(3) "-07" 54} 55 56--hexa indexed-- 57array(1) { 58 [18]=> 59 string(4) "0x12" 60} 61array(1) { 62 [10]=> 63 string(3) "0xA" 64} 65===DONE=== 66