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

mb_chr

Description

The mb_chr of Multibyte String for PHP return character by Unicode code point value.

Syntax

mb_chr(
    int $codepoint,
    ?string $encoding = null
): string|false

Parameters

codepoint

A Unicode codepoint value, e.g. 128024 for U+1F418 ELEPHANT

encoding

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

Return

A string containing the requested character, if it can be represented in the specified encoding or false on failure.

Examples

1 · codepoint

<?

$codepoint = '128024';

$return = mb_chr($codepoint);

echo $return;
🐘

2 · encoding

<?

$codepoint = '128024';
$encoding = 'UTF-8';

$return = mb_chr($codepoint, $encoding);

echo $return;
🐘

3 · failure

<?

$codepoint = '128024';
$encoding = 'ISO-8859-1';

$return = mb_chr($codepoint, $encoding);

var_export($return);
false
HomeMenu