PHP ltrim Function

What is ltrim Function in string?


The ltrim function is used to remove whitespaces or other characters from the begining of a string in PHP.



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 :

$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.

PHP Topics

Ask Questions

Ask Question