PHP ltrim() Function

PHP localeconv() Function
PHP md5() Function

What is the syntax of the LTRIM() function in php?

ltrim(string,charlist)
ParameterDescription
stringRequired. Specifies the string to check
charlistOptional. Specifies which characters to remove from the string. If omitted, all of the following characters are removed:”\0″ – NULL”\t” – tab”\n” – new line”\x0B” – vertical tab”\r” – carriage return” ” – ordinary white space
PHO ltrim() method

examples of the LTRIM() function

Example 1. In this example, remove characters from the left side of a string.

<?php
$str = "Hello World!";
echo $str . "<br>";
echo ltrim($str,"Hello");
?>

Example 2. In this example, we remove whitespaces from the left side of a string.

<?php
$str = "    Hello World!";
echo "Without ltrim: " . $str;
echo "<br>";
echo "With ltrim: " . ltrim($str);
?>

Example 3. In this example, we remove newlines (\n) from the left side of a string.

<?php
$str = "\n\n\nHello World!";
echo "Without ltrim: " . $str;
echo "<br>";
echo "With ltrim: " . ltrim($str);
?>

PHP localeconv() Function
PHP md5() Function
en English
X
Scroll to Top