Annotation of embedaddon/php/ext/standard/tests/strings/trim_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test trim() function : basic functionality
3: --FILE--
4: <?php
5:
6: /* Prototype : string trim ( string $str [, string $charlist ] )
7: * Description: Strip whitespace (or other characters) from the beginning and end of a string.
8: * Source code: ext/standard/string.c
9: */
10:
11: echo "*** Testing trim() : basic functionality ***\n";
12:
13: $text = " \t\r\n\0\x0B ---These are a few words--- \t\r\n\0\x0B ";
14: $hello = "!===Hello World===!";
15: $binary = "\x0A\x0DExample string\x0A\x0D";
16:
17: echo "\n-- Trim string with all white space characters --\n";
18: var_dump(trim($text));
19:
20: echo "\n-- Trim non-whitespace from a string --\n";
21: var_dump(trim($hello, "=!"));
22:
23: echo "\n-- Trim some non-white space characters from a string --\n";
24: var_dump(trim($hello, "Hdle"));
25:
26: echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
27: var_dump(trim($binary, "\x00..\x1F"));
28:
29: ?>
30: ===DONE===
31: --EXPECT--
32: *** Testing trim() : basic functionality ***
33:
34: -- Trim string with all white space characters --
35: string(27) "---These are a few words---"
36:
37: -- Trim non-whitespace from a string --
38: string(11) "Hello World"
39:
40: -- Trim some non-white space characters from a string --
41: string(19) "!===Hello World===!"
42:
43: -- Trim the ASCII control characters at the beginning of a string --
44: string(14) "Example string"
45: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>