Table of Contents

Syntax

string rtrim( string $text [, string $characterList )

(PHP 4, PHP 5)

$text The source string to escape pattern characters.
$characterList A list of characters to be removed.
RETURNS The source string with invalid characters stripped from the end.

What it Does

This method takes the source string ($text) and strips any whitespace characters from the end. This whitespace characters are shown below:

” ” Space
\t Tab
\n Line Feed
\r Carriage Return
\0 A null byte
\x0B A vertical tab

Optionally, you may alsp specify a list of characters you would like to be “trimmed” from the source string by specifying the third parameter $characterList.

Example

// Trim "e", "t" and "y" characters, result is "Not Pr";
$trimmed = rtrim('Not Pretty', 'ety');
echo 'Trimmed Text: ' . $trimmed . '<br>';
 
rtrim.txt · Last modified: 2011/02/18 17:20 by orvado
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki