1--TEST--
2Test 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
11echo "*** 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
18echo "\n-- Trim string with all white space characters --\n";
19var_dump(ltrim($text));
20
21echo "\n-- Trim non-whitespace from a string --\n";
22var_dump(ltrim($hello, "=!"));
23
24echo "\n-- Trim some non-white space characters from a string --\n";
25var_dump(ltrim($hello, "!oleH="));
26
27echo "\n-- Trim some non-white space characters from a string suing a character range --\n";
28var_dump(ltrim($alpha, "A..Z"));
29
30
31echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
32var_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 --
40string(29) "---These are a few words---  "
41
42-- Trim non-whitespace from a string --
43string(15) "Hello World===!"
44
45-- Trim some non-white space characters from a string --
46string(10) " World===!"
47
48-- Trim some non-white space characters from a string suing a character range --
49string(10) "0123456789"
50
51-- Trim the ASCII control characters at the beginning of a string --
52string(14) "Example string"
53===DONE===
54