The rtrim() function is a built-in function in PHP which removes whitespaces or other characters (if specified) from the right side of a string.
Syntax:
rtrim( $string, $charlist )
Parameters: The function rtrim() accepts two parameters as shown in the above syntax. Out of these two parameters, one is mandatory while the other one is optional. They are discussed in details below :
- $string: This mandatory parameter specifies the string to be checked.
- $charlist: This optional parameter specifies which characters are to be removed from the string.In case, this parameter is not provided, the following characters are removed :
- “