IntlChar::chr

(PHP 7)

IntlChar::chrReturn Unicode character by code point value

Opis

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().

Parametry

codepoint

Wartość typu integer dla punktu kodowego (np. 0x2603 dla U+2603 SNOWMAN) lub znak zakodowany jako string UTF-8 (np. "\u{2603}")

Zwracane wartości

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

Przykłady

Przykład #1 Testowanie różnych punktów kodowych

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

Powyższy przykład wyświetli:

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

Zobacz też:

  • IntlChar::ord() - Return Unicode code point value of character
  • chr() - Generate a single-byte string from a number

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top