xref: /PHP-5.5/ext/ereg/tests/split_error_001.phpt (revision 1881091e)
1--TEST--
2Test split() function : error conditions - wrong number of args
3--FILE--
4<?php
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
8 * Alias to functions:
9 */
10
11echo "*** Testing split() : error conditions - wrong number of args ***\n";
12
13
14//Test split with one more than the expected number of arguments
15echo "\n-- Testing split() function with more than expected no. of arguments --\n";
16$pattern = 'string_val';
17$string = 'string_val';
18$limit = 10;
19$extra_arg = 10;
20var_dump( split($pattern, $string, $limit, $extra_arg) );
21
22// Testing split with one less than the expected number of arguments
23echo "\n-- Testing split() function with less than expected no. of arguments --\n";
24$pattern = 'string_val';
25var_dump( split($pattern) );
26
27echo "Done";
28?>
29--EXPECTF--
30*** Testing split() : error conditions - wrong number of args ***
31
32-- Testing split() function with more than expected no. of arguments --
33
34Deprecated: Function split() is deprecated in %s on line %d
35
36Warning: split() expects at most 3 parameters, 4 given in %s on line %d
37NULL
38
39-- Testing split() function with less than expected no. of arguments --
40
41Deprecated: Function split() is deprecated in %s on line %d
42
43Warning: split() expects at least 2 parameters, 1 given in %s on line %d
44NULL
45Done
46