• PHP Video Tutorials

PHP - Function Rtrim



Syntax

string rtrim ( string $str [, string $character_mask ] )

Definition and Usage

It is used to remove the white spaces from end of the string

Return Values

It returns the modified string

Parameters

Sr.No Parameters & Description
1

string

It is a string input

2

character_mask

you can specifies the string that you can modify

Example

Try out the following example

<?php
   $input = "hi sai";
   
   echo $input . "<br>";
   echo rtrim($input,"sai");
?>

This will produce following result −

hi sai
hi
php_function_reference.htm
Advertisements