Home >Backend Development >PHP Problem >How to remove the symbol on the left side of a character in php
In PHP, you can use the ltrim() function to remove the symbol on the left side of the character. The function of this function is to remove the blank characters or other predefined characters on the left side of the string. You only need to set the parameter to the one specified on the left. The symbol is enough, and the syntax is "ltrim (the string of characters that need to be removed, the symbol on the left that needs to be removed)".
The operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer
ltrim() function removes whitespace characters or other predefined characters on the left side of a string.
Related functions:
rtrim() - Removes whitespace characters or other predefined characters on the right side of a string.
trim() - Removes whitespace or other predefined characters from both sides of a string.
The syntax is:
ltrim(string,charlist)
The example is as follows:
<?php $str = "Hello World!"; echo $str . "<br>"; echo ltrim($str,"Hello"); ?>
Output result:
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to remove the symbol on the left side of a character in php. For more information, please follow other related articles on the PHP Chinese website!