rtrim()


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

Description

rtrim() strips a white space (or other characters) from the end of a string

※ available F/W version : all

Parameters

Return values

Returns the modified string, PHP error on error

Example

<?php
hexdump(rtrim("\x0b\x00\x0d\x0a\x09\x20ABCDEFG\x0b\x00\x0d\x0a\x09\x20"));
//OUTPUT: 0000  0b 00 0d 0a 09 20 41 42  43 44 45 46 47           |..... ABCDEFG   |

echo rtrim(".0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ9876543210.", "012.34567"), "\r\n";
//OUTPUT: .0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ98

echo rtrim(".0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ9876543210.", "0..2....3..7"), "\r\n";
//OUTPUT: .0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ98
?>

See also

trim() / ltrim()

Remarks

This function is identical to the PHP group’s rtrim() function.