Annotation of embedaddon/php/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_uintersect_assoc() function : usage variation
3: --FILE--
4: <?php
5: /* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
6: * Description: U
7: * Source code: ext/standard/array.c
8: * Alias to functions:
9: */
10:
11: echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
12:
13: // Initialise function arguments not being substituted (if any)
14: $arr1 = array(1, 2);
15: $arr2 = array(1, 2);
16:
17: include('compare_function.inc');
18: $data_compare_function = 'compare_function';
19:
20: //get an unset variable
21: $unset_var = 10;
22: unset ($unset_var);
23:
24: // define some classes
25: class classWithToString
26: {
27: public function __toString() {
28: return "Class A object";
29: }
30: }
31:
32: class classWithoutToString
33: {
34: }
35:
36: // heredoc string
37: $heredoc = <<<EOT
38: hello world
39: EOT;
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: // null data
62: 'uppercase NULL' => NULL,
63: 'lowercase null' => null,
64:
65: // boolean data
66: 'lowercase true' => true,
67: 'lowercase false' =>false,
68: 'uppercase TRUE' =>TRUE,
69: 'uppercase FALSE' =>FALSE,
70:
71: // empty data
72: 'empty string DQ' => "",
73: 'empty string SQ' => '',
74:
75: // string data
76: 'string DQ' => "string",
77: 'string SQ' => 'string',
78: 'mixed case string' => "sTrInG",
79: 'heredoc' => $heredoc,
80:
81: // object data
82: 'instance of classWithToString' => new classWithToString(),
83: 'instance of classWithoutToString' => new classWithoutToString(),
84:
85: // undefined data
86: 'undefined var' => @$undefined_var,
87:
88: // unset data
89: 'unset var' => @$unset_var,
90: );
91:
92: // loop through each element of the array for ...
93:
94: foreach($inputs as $key =>$value) {
95: echo "\n--$key--\n";
96: var_dump( array_uintersect_assoc($arr1, $arr2, $value, $data_compare_function ) );
97: };
98:
99: ?>
100: ===DONE===
101: --EXPECTF--
102: *** Testing array_uintersect_assoc() : usage variation ***
103:
104: --int 0--
105:
106: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
107: NULL
108:
109: --int 1--
110:
111: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
112: NULL
113:
114: --int 12345--
115:
116: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
117: NULL
118:
119: --int -12345--
120:
121: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
122: NULL
123:
124: --float 10.5--
125:
126: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
127: NULL
128:
129: --float -10.5--
130:
131: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
132: NULL
133:
134: --float 12.3456789000e10--
135:
136: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
137: NULL
138:
139: --float -12.3456789000e10--
140:
141: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
142: NULL
143:
144: --float .5--
145:
146: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
147: NULL
148:
149: --uppercase NULL--
150:
151: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
152: NULL
153:
154: --lowercase null--
155:
156: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
157: NULL
158:
159: --lowercase true--
160:
161: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
162: NULL
163:
164: --lowercase false--
165:
166: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
167: NULL
168:
169: --uppercase TRUE--
170:
171: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
172: NULL
173:
174: --uppercase FALSE--
175:
176: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
177: NULL
178:
179: --empty string DQ--
180:
181: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
182: NULL
183:
184: --empty string SQ--
185:
186: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
187: NULL
188:
189: --string DQ--
190:
191: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
192: NULL
193:
194: --string SQ--
195:
196: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
197: NULL
198:
199: --mixed case string--
200:
201: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
202: NULL
203:
204: --heredoc--
205:
206: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
207: NULL
208:
209: --instance of classWithToString--
210:
211: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
212: NULL
213:
214: --instance of classWithoutToString--
215:
216: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
217: NULL
218:
219: --undefined var--
220:
221: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
222: NULL
223:
224: --unset var--
225:
226: Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d
227: NULL
228: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>