]> granicus.if.org Git - php/blob
b6bd9973b6
[php] /
1 --TEST--
2 Test chr() function : error conditions
3 --FILE--
4 <?php
5
6 /* Prototype  : string chr  ( int $ascii  )
7  * Description: Return a specific character
8  * Source code: ext/standard/string.c
9 */
10
11 echo "*** Testing chr() : error conditions ***\n";
12
13 echo "\n-- Testing chr() function with no arguments --\n";
14 try {
15     var_dump( chr() );
16 } catch (TypeError $e) {
17     echo $e->getMessage(), "\n";
18 }
19
20 echo "\n-- Testing chr() function with more than expected no. of arguments --\n";
21 $extra_arg = 10;
22 try {
23     var_dump( chr(72, $extra_arg) );
24 } catch (TypeError $e) {
25     echo $e->getMessage(), "\n";
26 }
27
28 ?>
29 --EXPECT--
30 *** Testing chr() : error conditions ***
31
32 -- Testing chr() function with no arguments --
33 chr() expects exactly 1 parameter, 0 given
34
35 -- Testing chr() function with more than expected no. of arguments --
36 chr() expects exactly 1 parameter, 2 given