1--TEST--
2Test chop() function : usage variations - miscellaneous arguments
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() : with miscellaneous arguments
12*/
13
14echo "*** Testing chop() : with miscellaneous arguments ***\n";
15
16 var_dump ( chop("chop test   \t\0 ") );                       /* without second Argument */
17 var_dump ( chop("chop test   " , "") );                       /* no characters in second Argument */
18 var_dump ( chop("chop test        ", NULL) );                 /* with NULL as second Argument */
19 var_dump ( chop("chop test        ", true) );                 /* with boolean value as second Argument */
20 var_dump ( chop("chop test        ", " ") );                  /* with single space as second Argument */
21 var_dump ( chop("chop test \t\n\r\0\x0B", "\t\n\r\0\x0B") );  /* with multiple escape sequences as second Argument */
22 var_dump ( chop("chop testABCXYZ", "A..Z") );                 /* with characters range as second Argument */
23 var_dump ( chop("chop test0123456789", "0..9") );             /* with numbers range as second Argument */
24 var_dump ( chop("chop test$#@", "#@$") );                     /* with some special characters as second Argument */
25
26echo "Done\n";
27?>
28--EXPECTF--
29*** Testing chop() : with miscellaneous arguments ***
30string(9) "chop test"
31string(12) "chop test   "
32string(17) "chop test        "
33string(17) "chop test        "
34string(9) "chop test"
35string(10) "chop test "
36string(9) "chop test"
37string(9) "chop test"
38string(9) "chop test"
39Done
40