Remove characters on the left side of a string:
<?php$str = "Hello World!";echo $str . "<br>";echo ltrim($str,"Hello");?>The ltrim() function removes whitespace characters or other predefined characters from the left side of a string.
Related functions:
rtrim() - Removes whitespace or other predefined characters from the right side of a string.
trim() - removes whitespace characters or other predefined characters on either side of a string.
ltrim( string,charlist )
parameter | describe |
---|---|
string | Required. Specifies the string to check. |
charlist | Optional. Specifies which characters are removed from a string. If this parameter is omitted, all the following characters are removed: " |