|
|
Tutorials » Php »
|
Topic |
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 "\0", "\t", "\n","\x0B","\r"," ".
Example:
<?php
$str = " \t\ttHiox 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.
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|