1--TEST--
2Test array_uintersect_uassoc() function : usage variation
3--FILE--
4<?php
5/* Prototype  : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
6 * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
7 * Source code: ext/standard/array.c
8 * Alias to functions:
9 */
10
11echo "*** Testing array_uintersect_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_compare_func = 'compare_function';
19$key_compare_func = 'compare_function';
20
21//get an unset variable
22$unset_var = 10;
23unset ($unset_var);
24
25// define some classes
26class classWithToString
27{
28	public function __toString() {
29		return "Class A object";
30	}
31}
32
33class classWithoutToString
34{
35}
36
37// heredoc string
38$heredoc = <<<EOT
39hello world
40EOT;
41
42// add arrays
43$index_array = array (1, 2, 3);
44$assoc_array = array ('one' => 1, 'two' => 2);
45
46//array of values to iterate over
47$inputs = array(
48
49      // int data
50      'int 0' => 0,
51      'int 1' => 1,
52      'int 12345' => 12345,
53      'int -12345' => -2345,
54
55      // float data
56      'float 10.5' => 10.5,
57      'float -10.5' => -10.5,
58      'float 12.3456789000e10' => 12.3456789000e10,
59      'float -12.3456789000e10' => -12.3456789000e10,
60      'float .5' => .5,
61
62      // null data
63      'uppercase NULL' => NULL,
64      'lowercase null' => null,
65
66      // boolean data
67      'lowercase true' => true,
68      'lowercase false' =>false,
69      'uppercase TRUE' =>TRUE,
70      'uppercase FALSE' =>FALSE,
71
72      // empty data
73      'empty string DQ' => "",
74      'empty string SQ' => '',
75
76      // string data
77      'string DQ' => "string",
78      'string SQ' => 'string',
79      'mixed case string' => "sTrInG",
80      'heredoc' => $heredoc,
81
82      // object data
83      'instance of classWithToString' => new classWithToString(),
84      'instance of classWithoutToString' => new classWithoutToString(),
85
86      // undefined data
87      'undefined var' => @$undefined_var,
88
89      // unset data
90      'unset var' => @$unset_var,
91);
92
93// loop through each element of the array for ...
94
95foreach($inputs as $key =>$value) {
96      echo "\n--$key--\n";
97      var_dump( array_uintersect_uassoc($arr1, $arr2, $value, $data_compare_func, $key_compare_func) );
98};
99
100?>
101===DONE===
102--EXPECTF--
103*** Testing array_uintersect_uassoc() : usage variation ***
104
105--int 0--
106
107Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
108NULL
109
110--int 1--
111
112Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
113NULL
114
115--int 12345--
116
117Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
118NULL
119
120--int -12345--
121
122Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
123NULL
124
125--float 10.5--
126
127Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
128NULL
129
130--float -10.5--
131
132Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
133NULL
134
135--float 12.3456789000e10--
136
137Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
138NULL
139
140--float -12.3456789000e10--
141
142Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
143NULL
144
145--float .5--
146
147Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
148NULL
149
150--uppercase NULL--
151
152Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
153NULL
154
155--lowercase null--
156
157Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
158NULL
159
160--lowercase true--
161
162Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
163NULL
164
165--lowercase false--
166
167Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
168NULL
169
170--uppercase TRUE--
171
172Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
173NULL
174
175--uppercase FALSE--
176
177Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
178NULL
179
180--empty string DQ--
181
182Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
183NULL
184
185--empty string SQ--
186
187Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
188NULL
189
190--string DQ--
191
192Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
193NULL
194
195--string SQ--
196
197Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
198NULL
199
200--mixed case string--
201
202Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
203NULL
204
205--heredoc--
206
207Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
208NULL
209
210--instance of classWithToString--
211
212Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
213NULL
214
215--instance of classWithoutToString--
216
217Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
218NULL
219
220--undefined var--
221
222Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
223NULL
224
225--unset var--
226
227Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d
228NULL
229===DONE===
230