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