IntlChar::chr

(PHP 7)

IntlChar::chrReturn Unicode character by code point value

Description

public static IntlChar::chr ( mixed $codepoint ) : string

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

This function compliments IntlChar::ord().

Liste de paramètres

codepoint

La valeur codepoint de type integer (i.e. 0x2603 pour U+2603 SNOWMAN), ou le caractère encodé en UTF-8 de type string (i.e. "\u{2603}")

Valeurs de retour

A string containing the single character specified by the Unicode code point value.

Exemples

Exemple #1 Test de différents codepoint

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

L'exemple ci-dessus va afficher :

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

Voir aussi

  • IntlChar::ord() - Return Unicode code point value of character
  • chr() - Générer une chaîne d'un octet à partir d'un nombre