1--TEST--
2Test join() function: error conditions
3--FILE--
4<?php
5/* Prototype  : string join( string $glue, array $pieces )
6 * Description: Join array elements with a string
7 * Source code: ext/standard/string.c
8 * Alias of function: implode()
9*/
10
11echo "*** Testing join() : error conditions ***\n";
12
13// Zero argument
14echo "\n-- Testing join() function with Zero arguments --\n";
15var_dump( join() );
16
17// More than expected number of arguments
18echo "\n-- Testing join() function with more than expected no. of arguments --\n";
19$glue = 'string_val';
20$pieces = array(1, 2);
21$extra_arg = 10;
22
23var_dump( join($glue, $pieces, $extra_arg) );
24
25// Less than expected number of arguments
26echo "\n-- Testing join() with less than expected no. of arguments --\n";
27$glue = 'string_val';
28
29var_dump( join($glue));
30
31echo "Done\n";
32?>
33--EXPECTF--
34*** Testing join() : error conditions ***
35
36-- Testing join() function with Zero arguments --
37
38Warning: join() expects at least 1 parameter, 0 given in %s on line %d
39NULL
40
41-- Testing join() function with more than expected no. of arguments --
42
43Warning: join() expects at most 2 parameters, 3 given in %s on line %d
44NULL
45
46-- Testing join() with less than expected no. of arguments --
47
48Warning: join(): Argument must be an array in %s on line %d
49NULL
50Done
51