The ltrim() function removes whitespace or other predefined characters from the left side of a string.
Related functions:
string ltrim ( string $str [, string $character_mask ] )
Strip whitespace (or other characters) from the beginning of a string.
string(32) " These are a few words :) ... " string(16) " Example string " string(11) "Hello World" string(30) "These are a few words :) ... " string(30) "These are a few words :) ... " string(7) "o World" string(15) "Example string "
Parameter | Description |
---|---|
str | Required. Specifies the string to check |
character_mask | You can also specify the characters you want to strip, by means of the character_mask parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters. |
This function returns a string with whitespace stripped from the beginning of str. Without the second parameter, ltrim() will strip these characters: