php ltrim() function
Translation results:
英[trɪm] 美[trɪm]
vt. Decorate; trim; organize
adj. Neat, tidy; slender; slender
n .Trim; tidy; healthy state; attire
vi.cut
Third person singular: trims Present participle: trimming Past tense: trimmed Past participle: trimmed Comparative: trimmer Superlative: trimmest
php ltrim() functionsyntax
How to use the ltrim() function?
php ltrim() function is used to delete spaces or other predefined characters on the left side of a string. The syntax is ltrim(string,charlist) and returns the string processed by charlist rules
Function:Delete spaces or other predefined characters on the left side of the string
Syntax: ltrim(string,charlist)
Parameters:
Parameter | Description |
string | Needs to be processed String |
charlist | is optional and specifies which characters to delete from the string. If it is empty, all the following characters "\0" -- NULL, "\t" -- tab character, "\n" -- line feed, "\x0B" -- vertical tab character, "\r" -- carriage return, " " -- space |
Description: Returns the string processed by charlist rules
php ltrim() functionexample
<?php $i = " hello world"; echo "未经过处理的".$i."左边是有空格的!"; $j = ltrim($i); echo "经过处理的".$j."左边是没有空格的!"; ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
未经过处理的 hello world左边是有空格的!经过处理的hello world左边是没有空格的