- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
rtrim() function in PHP
The rtrim() function is used to remove the white spaces from end of the string.
Syntax
rtrim(str, charlist)
Parameters
str − The string to check
charlist − Specifies which characters to remove from the string. If this parameter isn’t included, then, all of the below given characters are removed −
"\0" - NULL
"\t" - tab
"
" - new line"\x0B" - vertical tab
"\r" - carriage return
" " - ordinary white space
Return
The rtrim() function returns the modified string.
Example
The following is an example −
<?php $str = "Welcome to our website! "; echo "Applying rtrim(): " . rtrim($str); ?>
Output
The following is the output −
Applying rtrim(): Welcome to our website!
Example
Let us see another example −
<?php $str = "Welcome to our website!
"; echo "Applying rtrim(): " . rtrim($str); ?>
Output
The following is the output −
Applying rtrim(): Welcome to our website!
Advertisements