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.


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

Example 1


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

Example 2


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

Next TopicPHP String

Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA