PHP rtrim() Function
The rtrim()
function is used to removes whitespace or characters from the right side of a string.
Syntax
rtrim(string,charlist)
Parameter | Description |
---|---|
String | (Required) Specify the string to check. |
charlist | (optional) Specify character to remove the Following characters. |
|
Example
<?php $a = "Hello World!"; echo $a . "<br>"; echo rtrim($a,"World!"); ?>
Output
Hello World! Hello