2 /* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
3 * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
4 * Source code: ext/standard/array.c
8 echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
10 // Initialise function arguments not being substituted (if any)
13 include('compare_function.inc');
14 $data_comp_func = 'compare_function';
15 $key_comp_func = 'compare_function';
17 //get an unset variable
21 // define some classes
22 class classWithToString
24 public function __toString() {
25 return "Class A object";
29 class classWithoutToString
39 $index_array = array (1, 2, 3);
40 $assoc_array = array ('one' => 1, 'two' => 2);
42 //array of values to iterate over
49 'int -12345' => -2345,
53 'float -10.5' => -10.5,
54 'float 12.3456789000e10' => 12.3456789000e10
,
55 'float -12.3456789000e10' => -12.3456789000e10
,
59 'uppercase NULL' => NULL,
60 'lowercase null' => null,
63 'lowercase true' => true,
64 'lowercase false' =>false,
65 'uppercase TRUE' =>TRUE,
66 'uppercase FALSE' =>FALSE,
69 'empty string DQ' => "",
70 'empty string SQ' => '',
73 'string DQ' => "string",
74 'string SQ' => 'string',
75 'mixed case string' => "sTrInG",
76 'heredoc' => $heredoc,
79 'instance of classWithToString' => new classWithToString(),
80 'instance of classWithoutToString' => new classWithoutToString(),
83 'undefined var' => @$undefined_var,
86 'unset var' => @$unset_var,
89 // loop through each element of the array for arr2
91 foreach($inputs as $key =>$value) {
93 var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) );