英[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 trim() function syntax
How to use the trim() function?
php trim() function is used to remove spaces or other predefined characters at both ends of a string. The syntax is trim(string, charlist) and returns the string processed by charlist
Function:Remove spaces or other predefined characters at both ends of the string
Syntax: trim(string, charlist);
Parameters:
Parameter | Description |
string | Specifies to process The string |
charlist | is optional and specifies which characters are to be removed from the string. If it is empty, all the following characters are removed: "\0" -- NULL, "\t" -- tab character, "\n" -- line feed, "\x0B" -- vertical tab character, "\r" -- carriage return, " " -- space |
Description: Return the string processed by charlist
php trim() function example
<?php $i = " hello world "; echo "沒有經(jīng)過trim處理".$i; echo "<br>"; $j = trim($i); echo "經(jīng)過trim處理".$j; ?>
Run instance?
Click the "Run instance" button to view the online instance
Output:
沒有經(jīng)過trim處理 hello world 經(jīng)過trim處理hello world