1--TEST-- 2Test array_diff_key() function : usage variation - Passing null,unset and undefined variable indexed array 3--FILE-- 4<?php 5echo "*** Testing array_diff_key() : usage variation ***\n"; 6 7// Initialise function arguments not being substituted (if any) 8$input_array = array(10 => '10', "" => 'empty'); 9 10//get an unset variable 11$unset_var = 10; 12unset ($unset_var); 13 14$input_arrays = array( 15 'null indexed' => array(NULL => 'null 1', null => 'null 2'), 16 'undefined indexed' => array(@$undefined_var => 'undefined'), 17 'unset indexed' => array(@$unset_var => 'unset'), 18); 19 20foreach($input_arrays as $key =>$value) { 21 echo "\n--$key--\n"; 22 // loop through each element of the array for arr1 23 var_dump( array_diff_key($input_array, $value) ); 24 var_dump( array_diff_key($value, $input_array) ); 25} 26?> 27--EXPECT-- 28*** Testing array_diff_key() : usage variation *** 29 30--null indexed-- 31array(1) { 32 [10]=> 33 string(2) "10" 34} 35array(0) { 36} 37 38--undefined indexed-- 39array(1) { 40 [10]=> 41 string(2) "10" 42} 43array(0) { 44} 45 46--unset indexed-- 47array(1) { 48 [10]=> 49 string(2) "10" 50} 51array(0) { 52} 53