1--TEST--
2Test array_udiff_uassoc() function : usage variation
3--FILE--
4<?php
5/* Prototype  : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
6 * 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.
7 * Source code: ext/standard/array.c
8 * Alias to functions:
9 */
10
11echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
12
13// Initialise function arguments not being substituted (if any)
14$arr1 = array(1, 2);
15$arr2 = array(1, 2);
16
17include('compare_function.inc');
18$data_comp_func = 'compare_function';
19
20//get an unset variable
21$unset_var = 10;
22unset ($unset_var);
23
24// define some classes
25class classWithToString
26{
27	public function __toString() {
28		return "Class A object";
29	}
30}
31
32class classWithoutToString
33{
34}
35
36// heredoc string
37$heredoc = <<<EOT
38hello world
39EOT;
40
41// add arrays
42$index_array = array (1, 2, 3);
43$assoc_array = array ('one' => 1, 'two' => 2);
44
45//array of values to iterate over
46$inputs = array(
47
48      // int data
49      'int 0' => 0,
50      'int 1' => 1,
51      'int 12345' => 12345,
52      'int -12345' => -2345,
53
54      // float data
55      'float 10.5' => 10.5,
56      'float -10.5' => -10.5,
57      'float 12.3456789000e10' => 12.3456789000e10,
58      'float -12.3456789000e10' => -12.3456789000e10,
59      'float .5' => .5,
60
61      // array data
62      'empty array' => array(),
63      'int indexed array' => $index_array,
64      'associative array' => $assoc_array,
65      'nested arrays' => array('foo', $index_array, $assoc_array),
66
67      // null data
68      'uppercase NULL' => NULL,
69      'lowercase null' => null,
70
71      // boolean data
72      'lowercase true' => true,
73      'lowercase false' =>false,
74      'uppercase TRUE' =>TRUE,
75      'uppercase FALSE' =>FALSE,
76
77      // empty data
78      'empty string DQ' => "",
79      'empty string SQ' => '',
80
81      // string data
82      'string DQ' => "string",
83      'string SQ' => 'string',
84      'mixed case string' => "sTrInG",
85      'heredoc' => $heredoc,
86
87      // object data
88      'instance of classWithToString' => new classWithToString(),
89      'instance of classWithoutToString' => new classWithoutToString(),
90
91      // undefined data
92      'undefined var' => @$undefined_var,
93
94      // unset data
95      'unset var' => @$unset_var,
96);
97
98// loop through each element of the array for key_comp_func
99
100foreach($inputs as $key =>$value) {
101      echo "\n--$key--\n";
102      var_dump( array_udiff_uassoc($arr1, $arr2, $data_comp_func, $value) );
103};
104
105?>
106===DONE===
107--EXPECTF--
108*** Testing array_udiff_uassoc() : usage variation ***
109
110--int 0--
111
112Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
113NULL
114
115--int 1--
116
117Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
118NULL
119
120--int 12345--
121
122Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
123NULL
124
125--int -12345--
126
127Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
128NULL
129
130--float 10.5--
131
132Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
133NULL
134
135--float -10.5--
136
137Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
138NULL
139
140--float 12.3456789000e10--
141
142Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
143NULL
144
145--float -12.3456789000e10--
146
147Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
148NULL
149
150--float .5--
151
152Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
153NULL
154
155--empty array--
156
157Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation4.php on line %d
158NULL
159
160--int indexed array--
161
162Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation4.php on line %d
163NULL
164
165--associative array--
166
167Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, first array member is not a valid class name or object in %sarray_udiff_uassoc_variation4.php on line %d
168NULL
169
170--nested arrays--
171
172Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation4.php on line %d
173NULL
174
175--uppercase NULL--
176
177Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
178NULL
179
180--lowercase null--
181
182Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
183NULL
184
185--lowercase true--
186
187Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
188NULL
189
190--lowercase false--
191
192Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
193NULL
194
195--uppercase TRUE--
196
197Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
198NULL
199
200--uppercase FALSE--
201
202Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
203NULL
204
205--empty string DQ--
206
207Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d
208NULL
209
210--empty string SQ--
211
212Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d
213NULL
214
215--string DQ--
216
217Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d
218NULL
219
220--string SQ--
221
222Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d
223NULL
224
225--mixed case string--
226
227Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d
228NULL
229
230--heredoc--
231
232Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d
233NULL
234
235--instance of classWithToString--
236
237Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
238NULL
239
240--instance of classWithoutToString--
241
242Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
243NULL
244
245--undefined var--
246
247Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
248NULL
249
250--unset var--
251
252Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d
253NULL
254===DONE===
255