php8.5
Home/ Manual/ intl / intlchar/ IntlChar::chr

IntlChar::chr

PHP function Edit on GitHub ✎

(PHP 7, PHP 8)

Return Unicode character by code point value

Description

IntlChar::chr(int|string $codepoint): string|null

Returns a string containing the character specified by the Unicode code point value.

This method complements IntlChar::ord.

Parameters

codepoint

Parameter

Return Values

A string containing the single character specified by the Unicode code point value, or null on failure.

Examples

Example

php
<?php
$values = ["A", 63, 123, 9731];
foreach ($values as $value) {
    var_dump(IntlChar::chr($value));
}
?>

The above example will output:

output
string(1) "A"
string(1) "?"
string(1) "{"
string(3) "☃"

See Also

Source: reference/intl/intlchar/chr.xml · from the official PHP manual (php/doc-en)