1--TEST--
2Test ucwords() function : error conditions
3--FILE--
4<?php
5/* Prototype  : string ucwords ( string $str )
6 * Description: Uppercase the first character of each word in a string
7 * Source code: ext/standard/string.c
8*/
9
10echo "*** Testing ucwords() : error conditions ***\n";
11
12// Zero argument
13echo "\n-- Testing ucwords() function with Zero arguments --\n";
14var_dump( ucwords() );
15
16// More than expected number of arguments
17echo "\n-- Testing ucwords() function with more than expected no. of arguments --\n";
18$str = 'string_val';
19$extra_arg = 10;
20
21var_dump( ucwords($str, $extra_arg, $extra_arg) );
22
23// check if there were any changes made to $str
24var_dump($str);
25
26echo "Done\n";
27?>
28--EXPECTF--
29*** Testing ucwords() : error conditions ***
30
31-- Testing ucwords() function with Zero arguments --
32
33Warning: ucwords() expects at least 1 parameter, 0 given in %s on line %d
34NULL
35
36-- Testing ucwords() function with more than expected no. of arguments --
37
38Warning: ucwords() expects at most 2 parameters, 3 given in %s on line %d
39NULL
40string(10) "string_val"
41Done
42