1--TEST-- 2Test array_diff_key() function : usage variation - Passing integer indexed array 3--FILE-- 4<?php 5/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...]) 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_key() : 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 21// loop through each element of the array for arr1 22foreach($input_arrays as $key =>$value) { 23 echo "\n--$key--\n"; 24 var_dump( array_diff_key($input_array, $value) ); 25 var_dump( array_diff_key($value, $input_array) ); 26} 27?> 28===DONE=== 29--EXPECTF-- 30*** Testing array_diff_key() : usage variation *** 31 32--decimal indexed-- 33array(1) { 34 [-7]=> 35 string(3) "-07" 36} 37array(1) { 38 [-17]=> 39 string(3) "-17" 40} 41 42--octal indexed-- 43array(1) { 44 [-7]=> 45 string(3) "-07" 46} 47array(1) { 48 [-9]=> 49 string(4) "-011" 50} 51 52--hexa indexed-- 53array(1) { 54 [10]=> 55 string(3) "0xA" 56} 57array(1) { 58 [18]=> 59 string(4) "0x12" 60} 61===DONE===