1--TEST--
2Test rtrim() function : basic functionality
3--FILE--
4<?php
5
6echo "*** Testing rtrim() : basic functionality ***\n";
7
8$text  = "---These are a few words---  \t\r\n\0\x0B  ";
9$hello  = "!===Hello World===!";
10$alpha = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
11$binary = "Example string\x0A\x0D";
12
13
14
15echo "\n-- Trim string with all white space characters --\n";
16var_dump(rtrim($text));
17
18echo "\n-- Trim non-whitespace from a string --\n";
19var_dump(rtrim($hello, "=!"));
20
21echo "\n-- Trim some non-white space characters from a string --\n";
22var_dump(rtrim($hello, "!dlWro="));
23
24echo "\n-- Trim some non-white space characters from a string using a character range --\n";
25var_dump(rtrim($alpha, "A..Z"));
26
27echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
28var_dump(rtrim($binary, "\x00..\x1F"));
29
30?>
31--EXPECT--
32*** Testing rtrim() : basic functionality ***
33
34-- Trim string with all white space characters --
35string(27) "---These are a few words---"
36
37-- Trim non-whitespace from a string --
38string(15) "!===Hello World"
39
40-- Trim some non-white space characters from a string --
41string(10) "!===Hello "
42
43-- Trim some non-white space characters from a string using a character range --
44string(10) "0123456789"
45
46-- Trim the ASCII control characters at the beginning of a string --
47string(14) "Example string"
48