PHP.nl

mb_chr

mb_chr

Return character by Unicode code point value

 **mb_chr** int $codepoint  $encoding

Returns a string containing the character specified by the Unicode code point value, encoded in the specified encoding.

This function complements . mb_ord

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

encodingA string containing the requested character, if it can be represented in the specified encoding return.falseforfailure.

Voorbeeld: intl.codepoint.example

<?php
$values = [65, 63, 0x20AC, 128024];
foreach ($values as $value) {
    var_dump(mb_chr($value, 'UTF-8'));
    var_dump(mb_chr($value, 'ISO-8859-1'));
}
?>
string(1) "A"
string(1) "A"
string(1) "?"
string(1) "?"
string(3) "€"
bool(false)
string(4) "🐘"
bool(false)

mb_internal_encoding``mb_ord``IntlChar::ord``chr