English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP String Character String Functions Manual
The ltrim() function is used to remove whitespace characters (or other characters) from the beginning of the string.
string ltrim ( string $str[, string $character_mask] )
It is used to remove spaces or other specified characters from the beginning of the string
Related Functions:
rtrim() - Remove whitespace characters or other predefined characters from the end of the string.
trim() - Remove whitespace characters or other predefined characters from both sides of the string.
This function returns a string with the leading whitespace characters of str removed. If the second parameter is not used, ltrim() only removes the following characters:
"\0" - NULL
"\t" - Tab
"\n" - Newline
"\x0B" - Vertical Tab
"\r" - Enter
" " - Space
Serial Number | Parameters and Description |
---|---|
1 | str Input String |
2 | character_mask You can also specify the characters you want to remove through the parameter character_mask. Simply list all the characters you want to remove. Use .. to specify a range of characters. |
Try the following example
<?php $str = " www.oldtoolbag.com! "; echo $str . "<br>"; echo ltrim($str,"simply easy learning"); ?>Test and See‹/›
Output Result
www.oldtoolbag.com! www.oldtoolbag.com!