1--TEST-- 2Test array_diff_ukey() function : usage variation - Passing null,unset and undefined variable 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(10 => '10', "" => 'empty'); 14 15//get an unset variable 16$unset_var = 10; 17unset ($unset_var); 18 19$input_arrays = array( 20 'null indexed' => array(NULL => 'null 1', null => 'null 2'), 21 'undefined indexed' => array(@$undefined_var => 'undefined'), 22 'unset indexed' => array(@$unset_var => 'unset'), 23); 24 25foreach($input_arrays as $key =>$value) { 26 echo "\n--$key--\n"; 27 var_dump( array_diff_ukey($value, $input_array, 'strcasecmp') ); 28 var_dump( array_diff_ukey($input_array, $value, 'strcasecmp') ); 29} 30 31?> 32===DONE=== 33--EXPECTF-- 34*** Testing array_diff_ukey() : usage variation *** 35 36--null indexed-- 37array(0) { 38} 39array(1) { 40 [10]=> 41 string(2) "10" 42} 43 44--undefined indexed-- 45array(0) { 46} 47array(1) { 48 [10]=> 49 string(2) "10" 50} 51 52--unset indexed-- 53array(0) { 54} 55array(1) { 56 [10]=> 57 string(2) "10" 58} 59===DONE=== 60