PHP ltrim Function
What is ltrim Function in string?
Explanation
The ltrim function is used to remove whitespaces or other characters from the begining of a string in PHP.
Syntax:
ltrim(string,charlist)
In the above syntax "string" specifies the strings from which the required characters to be removed,"charlist" specifies the characters to be removed which include " ", "t", "n","x0B","r"," ".
Example :
<?php
$str = "
tttHiox India!";
echo "Without ltrim:". $str;
echo "<br/>";
echo "With ltrim:". ltrim($str);
?>
Result :
Without ltrim:
Hiox India!
With ltrim:Hiox India
In the above example the result displays the text "Hiox India!" without and with ltrim.