Javatpoint Logo
Javatpoint Logo

PHP string rtrim() Function

PHP rtrim() is predefined function which is used to remove whitespace or character form the right side of a string.

Syntax:

Parameter Description Required/Optional
string Specify the string to check. required
charlist Specify character to remove Following character
  • "\0" - NULL
  • "\t" - tab
  • "\n" - new line
  • "\x0B" - vertical tab
  • "\r" - carriage return
  • " " - ordinary white space
Optional

Example 1

Output:

Without rtrim() function: Hello PHP! 
With rtrim() function:Hello PHP!

Example 2

Output:

Without trim() function: Hello PHP! 
With trim() function: Hello PHP!

Next TopicPHP String




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA