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