summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/join_error.phpt
blob: 976dd97242e61496e0b03cdc8751c46fe60fa963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--TEST--
Test join() function: error conditions
--FILE--
<?php
/* Prototype  : string join( string $glue, array $pieces )
 * Description: Join array elements with a string
 * Source code: ext/standard/string.c
 * Alias of function: implode()
*/

echo "*** Testing join() : error conditions ***\n";

// Less than expected number of arguments
echo "\n-- Testing join() with less than expected no. of arguments --\n";
$glue = 'string_val';

try {
    var_dump(join($glue));
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}

echo "Done\n";
?>
--EXPECT--
*** Testing join() : error conditions ***

-- Testing join() with less than expected no. of arguments --
join() expects argument #1 ($pieces) to be of type array, string given
Done