PHP
php.net › manual › en › function.rtrim.php
PHP: rtrim - Manual
This shows how rtrim works when using the optional charlist parameter: rtrim reads a character, one at a time, from the optional charlist parameter and compares it to the end of the str string.
W3Schools
w3schools.com › php › func_string_rtrim.asp
PHP rtrim() Function
<!DOCTYPE html> <html> <body> Without rtrim: Hello World! <br>With rtrim: Hello World! </body> </html> ... <?php $str = "Hello World!\n\n\n"; echo "Without rtrim: " . $str; echo "<br>"; echo "With rtrim: " .
PHP Tutorial
phptutorial.net › home › php tutorial › php rtrim
PHP rtrim: Remove Characters from the End of a String
April 7, 2025 - In this tutorial, you'll learn how to use the PHP rtrim() function to remove whitespace or other characters from the end of a string.
What does PHP rtrim() do and how does it work?
The rtrim() function in PHP removes characters from the end of a string. By default, it removes whitespace characters like spaces, tabs, newlines, and null bytes. You can also pass a custom character mask to remove specific characters from the right side. It returns a new string and leaves the original string unchanged.
flatcoding.com
flatcoding.com › home › php rtrim function: remove trailing characters or whitespace
PHP rtrim Function: Remove Trailing Characters or Whitespace - ...
How can I remove trailing slashes or dots in PHP?
You can use rtrim() with a custom character mask to remove trailing slashes or dots. For example:
$url = "example.com///";
echo rtrim($url, "/"); // "example.com"
This removes all slashes from the end of the string. You can also remove dots by passing "." or any combination like ".-/".flatcoding.com
flatcoding.com › home › php rtrim function: remove trailing characters or whitespace
PHP rtrim Function: Remove Trailing Characters or Whitespace - ...
Tutorial Republic
tutorialrepublic.com › php-reference › php-rtrim-function.php
PHP rtrim() Function - Tutorial Republic
Here're some more examples showing how rtrim() function actually works: In the following example only space and new line characters from the end of the string will be stripped. Whitespace characters at the beginning and inside of the string will remain intact. ... <?php // Sample string $str = " \tHello\n World!\n "; // Trimming the trailing whitespace echo rtrim($str); ?>
TutorialsPoint
tutorialspoint.com › rtrim-function-in-php
PHP String rtrim() Function
December 26, 2019 - The PHP String rtrim() function is used to return strip whitespace or other characters from the end of a string. This function accepts two parameters as argument. Without the second option, rtrim() will strip the following characters − Below is the
Scientech Easy
scientecheasy.com › home › blog › php ltrim() and rtrim() functions with examples
PHP ltrim() and rtrim() Functions with Examples - Scientech Easy
June 2, 2025 - Learn how to use PHP ltrim() and rtrim() functions to remove characters from the left and right ends of a string. Includes syntax, examples.
GeeksforGeeks
geeksforgeeks.org › php › php-rtrim-function
PHP rtrim() Function - GeeksforGeeks
September 23, 2024 - In this example, the rtrim() function is used with a specified character list, where specific characters like !, (, and ) are removed from the right side of the string. ... <?php $string = "Geeks for !!! (( !!))"; // The characters '!', '(', ')', ' ' have been specified // to remove from the end of the string echo rtrim($string, "!
Jobtensor
jobtensor.com › Tutorial › PHP › en › String-Functions-rtrim
PHP Built-in rtrim(), Definition, Syntax, Parameters, Examples | jobtensor
The rtrim() function removes whitespace or other predefined characters from the right side of a string. ... <?php $hello = "Hello World! "; echo "Without rtrim: " . $hello; echo "<br>"; echo "With rtrim: " .
Experts PHP
expertsphp.com › rtrim-function-in-php-8-1-and-8-2-with-example
rtrim() Function in PHP 8.1 and 8.2 With Example - Experts PHP
March 22, 2024 - <?php rtrim ( string $string , string $characters = " \t\n\r\0\x0B" ) : string ?> Parameters: 1. `$string`: The input string to be trimmed. 2. `$characters` (optional): The characters you want to remove. If not provided, it will remove whitespace characters. Return Value: Returns the trimmed string.
W3schoolsapp
w3schools.w3schoolsapp.com › php › func_string_rtrim.html
PHP rtrim() Function
zip_close() zip_entry_close() ... zip_entry_open() zip_entry_read() zip_open() zip_read() PHP Timezones ... The rtrim() function removes whitespace or other predefined characters from the right side of a string....
Javatpoint
javatpoint.com › php-string-rtrim-function
PHP rtrim() function - javatpoint
PHP Function The function is predefined function of PHP. It is used to find the length of string or returns the length of a string including all the whitespaces and special character. Syntax: strlen(string); Parameter Description Required/Optional String Specify the string to check.
W3Schools
www-db.deis.unibo.it › courses › TW › DOCS › w3schools › php › func_string_rtrim.asp.html
PHP rtrim() Function
PHP Array PHP Calendar PHP Date ... SimpleXML PHP String PHP XML PHP Zip PHP Timezones ... The rtrim() function removes whitespace or other predefined characters from the right side of a string....