HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

mb_ltrim

Description

The mb_ltrim of Multibyte String for PHP strips whitespace (or other characters) from the beginning of a string.

Syntax

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

Parameters

string

The input string.

characters

The list of all the characters that need to be stripped.

encoding

The character encoding.

If omitted or null, the internal character encoding value will be used.

Return

Returns a string with whitespace stripped from the beginning of the string.

Examples

1 · string

<?

$string = "\0\t\n\v\r \x00\x09\x0A\x0B\x0D\x20🐘string";

$return = mb_ltrim($string);

var_dump($string, $return);
string(22) "    

     

 🐘string"
string(10) "🐘string"

2 · characters

<?

$string = "\0\t\n\v\r \x00\x09\x0A\x0B\x0D\x20🐘string";
$characters = "\0\t\n\v\r 🐘s";

$return = mb_ltrim($string, $characters);

var_dump($string, $return);
string(22) "    

     

 🐘string"
string(5) "tring"

3 · encoding

<?

$string = "\0\t\n\v\r \x00\x09\x0A\x0B\x0D\x20🐘string";
$characters = "\0\t\n\v\r 🐘s";
$encoding = "UTF-8";

$return = mb_ltrim($string, $characters, $encoding);

var_dump($string, $return);
string(22) "    

     

 🐘string"
string(5) "tring"