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

mb_strwidth

Description

Return width of string

Syntax

mb_strwidth(
    string $string,
    ?string $encoding = null
): int

Parameters

string

The string being decoded.

encoding

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

Return

The width of string string.

Examples

1 · string

<?

$string = '🐘';

$return = mb_strwidth($string);

echo $return;

?>
2

2 · encoding

<?

$string = '🐘';
$encoding = 'UTF-8';

$return = mb_strwidth($string, $encoding);

echo $return;

?>
2
HomeMenu