2 Test split() function : usage variations - unexpected type for arg 1
5 /* Prototype : proto array split(string pattern, string string [, int limit])
6 * Description: Split string into array by regular expression
7 * Source code: ext/standard/reg.c
11 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
12 echo "Error: $err_no - $err_msg, $filename($linenum)\n";
14 set_error_handler('test_error_handler');
16 echo "*** Testing split() : usage variations ***\n";
18 // Initialise function arguments not being substituted (if any)
19 $string = '1 a 1 Array 1 c ';
22 //get an unset variable
26 //array of values to iterate over
47 array('color' => 'red', 'item' => 'pen'),
73 // loop through each element of the array for pattern
75 foreach($values as $value) {
76 echo "\nArg value $value \n";
77 var_dump( split($value, $string, $limit) );
83 *** Testing split() : usage variations ***
84 Error: 8 - Undefined variable: undefined_var, %s(64)
85 Error: 8 - Undefined variable: unset_var, %s(67)
88 Error: 8192 - Function split() is deprecated, %s(74)
91 string(16) "1 a 1 Array 1 c "
95 Error: 8192 - Function split() is deprecated, %s(74)
108 Error: 8192 - Function split() is deprecated, %s(74)
111 string(16) "1 a 1 Array 1 c "
115 Error: 8192 - Function split() is deprecated, %s(74)
118 string(16) "1 a 1 Array 1 c "
122 Error: 8192 - Function split() is deprecated, %s(74)
125 string(16) "1 a 1 Array 1 c "
129 Error: 8192 - Function split() is deprecated, %s(74)
132 string(16) "1 a 1 Array 1 c "
135 Arg value 101234567000
136 Error: 8192 - Function split() is deprecated, %s(74)
139 string(16) "1 a 1 Array 1 c "
142 Arg value 1.07654321E-9
143 Error: 8192 - Function split() is deprecated, %s(74)
146 string(16) "1 a 1 Array 1 c "
150 Error: 8192 - Function split() is deprecated, %s(74)
153 string(16) "1 a 1 Array 1 c "
155 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
158 Error: 8192 - Function split() is deprecated, %s(74)
159 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
161 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
164 Error: 8192 - Function split() is deprecated, %s(74)
165 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
167 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
170 Error: 8192 - Function split() is deprecated, %s(74)
171 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
173 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
176 Error: 8192 - Function split() is deprecated, %s(74)
177 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
179 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
182 Error: 8192 - Function split() is deprecated, %s(74)
183 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
187 Error: 8192 - Function split() is deprecated, %s(74)
188 Error: 2 - split(): REG_EMPTY, %s(74)
192 Error: 8192 - Function split() is deprecated, %s(74)
193 Error: 2 - split(): REG_EMPTY, %s(74)
197 Error: 8192 - Function split() is deprecated, %s(74)
210 Error: 8192 - Function split() is deprecated, %s(74)
211 Error: 2 - split(): REG_EMPTY, %s(74)
215 Error: 8192 - Function split() is deprecated, %s(74)
228 Error: 8192 - Function split() is deprecated, %s(74)
229 Error: 2 - split(): REG_EMPTY, %s(74)
233 Error: 8192 - Function split() is deprecated, %s(74)
234 Error: 2 - split(): REG_EMPTY, %s(74)
238 Error: 8192 - Function split() is deprecated, %s(74)
239 Error: 2 - split(): REG_EMPTY, %s(74)
241 Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
244 Error: 8192 - Function split() is deprecated, %s(74)
245 Error: 2 - split() expects parameter 1 to be string, object given, %s(74)
249 Error: 8192 - Function split() is deprecated, %s(74)
250 Error: 2 - split(): REG_EMPTY, %s(74)
254 Error: 8192 - Function split() is deprecated, %s(74)
255 Error: 2 - split(): REG_EMPTY, %s(74)