Php Getting Started Tutorial: php rtrim () instance tutorial
Definition and usage
The rtrim () function will remove spaces or other pre-determined properties from a string on the right.
Syntax
Rtrim (string, charlist)
Parameter description
String required. Specified string check
Charlist is optional. The specified character to delete the string. If omitted, all the following characters are deleted:
"0"-null
"T" type-label
"& Ntilde;"-new production line
"X0B"-vertical label
"R" start-press enter
""-Ordinary white space
Example 1
<Html> <body> <? Php $ str = "Hello World! "; Echo" Without rtrim: ". $ str; echo" <br/> "; echo" With rtrim: ". rtrim ($ str);?> <Body>
Output result.
Without rtrim: Hello World! With rtrim: Hello World!
If you select "View Source File" in the browser window, you will see the following HTML:
<Html> <body> Without rtrim: Hello World! <Br/> With rtrim: Hello World! </Body>
Instance 2.
<? Php $ str = "Hello World! Rn "; echo" Without rtrim: ". $ str; echo" <br/> "; echo" With rtrim: ". rtrim ($ str);?>
Output.
Without rtrim: Hello World! With rtrim: Hello World!