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