PHP rtrim() Function

Definition

The rtrim() function trims whitespace from the righthand side of a string.

Syntax

PHP rtrim() Function has the following syntax.

string rtrim ( string str [, string trim_chars] )

Parameter

The optional second parameter to trim() sets the individual characters you want it to trim.

Return

PHP rtrim() Function returns the right trimmed string.

Example

trim a string from right


<?PHP
$string = rtrim(" java2s.com "); 
print ">"+$string+"<";
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions