ltrim

string ltrim(string string) 

Removes whitespace from the left end of a string.

Returns:

String; FALSE on error

Description:

ltrim() removes all whitespace from the left end of a string. The function considers the following characters to be whitespace:

Character Name ASCII Value PHP Character Escape Sequence
null 0 \0
tab 9 \t
newline 10 \n
vertical tab 11 none
carriage return 13 \r
space 32 none

Version:

PHP 3+, PHP 4+

See also:

To trim space from both ends of a string:

trim() 

To trim space from the right end of a string:

chop() 
rtrim() 

Example:

Trim whitespace from the left end of a string
 <?php $string = "\t\tA red bird, ink tore thy eye.\t\t"; echo "Original string : '$string'\n", "ltrim()'d string: '", ltrim ($string), "'"; ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.