mb_ltrim()
mb_ltrim() — Strip whitespace (or other characters) from the beginning of a string.
Built-in function of PHP 8.5. The manual lists it as available in PHP 8 >= 8.4.0. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Performs a multi-byte safe ltrim() operation. Strip whitespace (or other characters) from the beginning of a string.
Signature
mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $string | string | The input string. |
| $characters | ?string | Optionally, the stripped characters can also be specified using the characters parameter. Simply list all characters that need to be stripped. |
| $encoding | ?string | The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. |
Return value
This function returns a string with whitespace stripped from the beginning of string.
Example
The PHP manual ships no example for mb_ltrim(); the signature and the parameter table above are the contract.
See also
mb_trim(), mb_rtrim(), ltrim()
All PHP 8.5 built-in functions
Reference card built from the PHP manual page mb_ltrim() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.