array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.mb-rtrim.php', 1 => 'mb_rtrim', 2 => 'Strip whitespace (or other characters) from the end of a string', ), 'up' => array ( 0 => 'ref.mbstring.php', 1 => 'Multibyte String Functions', ), 'prev' => array ( 0 => 'function.mb-regex-set-options.php', 1 => 'mb_regex_set_options', ), 'next' => array ( 0 => 'function.mb-scrub.php', 1 => 'mb_scrub', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mbstring/functions/mb-rtrim.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

mb_rtrim

(PHP 8 >= 8.4.0)

mb_rtrimStrip whitespace (or other characters) from the end of a string

Description

mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string

Performs a multi-byte safe rtrim() operation, and returns a string with whitespace (or other characters) stripped from the end of string.

Without the second parameter, mb_rtrim() will strip these characters:

Parameters

string
The input string.
characters
Optionally, the stripped characters can also be specified using the characters parameter. Simply list all characters that need to be stripped.
encoding

The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used.

Return Values

Returns the modified string.

See Also