php rtrim() 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 rtrim() functionsyntax
How to use the rtrim() function?
php rtrim() function is used to delete spaces or other predefined characters on the right side of a string. The syntax is rtrim(string,charlist) and returns the string processed by charlist rules
Function:Delete spaces or other predefined characters on the right side of the string
Syntax: rtrim(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 rtrim() functionexample
<?php $i = "hello world "; echo "未经过处理的".$i."右边是有空格的!"; $j = rtrim($i); echo "经过处理的".$j."右边是没有空格的!"; ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
未经过处理的hello world 右边是有空格的!经过处理的hello world右边是没有空格的!