CakeFest 2024: The Official CakePHP Conference

IntlChar::ord

(PHP 7, PHP 8)

IntlChar::ordReturn Unicode code point value of character

Beschreibung

public static IntlChar::ord(int|string $character): ?int

Returns the Unicode code point value of the given character.

This function complements IntlChar::chr().

Parameter-Liste

character

Ein Wert vom Typ int, der einen Codepoint darstellt (z. B. 0x2603 für U+2603 SNOWMAN) oder ein als UTF-8-String kodiertes Zeichen (z. B. "\u{2603}")

Rückgabewerte

Returns the Unicode code point value as an integer.

Beispiele

Beispiel #1 Testen unterschiedlicher Codepoints

<?php
var_dump
(IntlChar::ord("A"));
var_dump(IntlChar::ord(" "));
var_dump(IntlChar::ord("\u{2603}"));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

int(65)
int(32)
int(9731)

Siehe auch

  • IntlChar::chr() - Return Unicode character by code point value
  • mb_ord() - Get Unicode code point of character
  • ord() - Konvertiert das erste Byte einer Zeichenkette in einen Wert zwischen 0 und 255

add a note

User Contributed Notes

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