1--TEST--
2Test explode() function : error conditions
3--FILE--
4<?php
5
6/* Prototype  : array explode  ( string $delimiter  , string $string  [, int $limit  ] )
7 * Description: Split a string by string.
8 * Source code: ext/standard/string.c
9*/
10
11echo "*** Testing explode() : error conditions ***\n";
12
13echo "\n-- Testing explode() function with no arguments --\n";
14var_dump( explode() );
15
16echo "\n-- Testing explode() function with more than expected no. of arguments --\n";
17$delimiter = " ";
18$string = "piece1 piece2 piece3 piece4 piece5 piece6";
19$limit = 5;
20$extra_arg = 10;
21var_dump( explode($delimiter, $string, $limit, $extra_arg) );
22
23?>
24===Done===
25--EXPECTF--
26*** Testing explode() : error conditions ***
27
28-- Testing explode() function with no arguments --
29
30Warning: explode() expects at least 2 parameters, 0 given in %s on line %d
31NULL
32
33-- Testing explode() function with more than expected no. of arguments --
34
35Warning: explode() expects at most 3 parameters, 4 given in %s on line %d
36NULL
37===Done===
38