php8.5
Home/ Manual/ mbstring / functions/ mb_trim

mb_trim

PHP function Edit on GitHub ✎

(PHP 8 >= 8.4.0)

Strip whitespace (or other characters) from the beginning and end of a string

Description

mb_trim(string $string, string|null $characters = null, string|null $encoding = null): string

Performs a multi-byte safe trim() operation, and returns a string with whitespace stripped from the beginning and end of string. Without the second parameter, mb_trim() will strip these characters:

Unicode

Parameters

string

The string that will be trimmed.

characters

Optional

encoding

Parameter

Return Values

The trimmed string.

See Also

Source: reference/mbstring/functions/mb-trim.xml · from the official PHP manual (php/doc-en)