IntlChar::ord

(PHP 7, PHP 8)

IntlChar::ordReturn Unicode code point value of character

説明

public static IntlChar::ord(mixed $character): int

Returns the Unicode code point value of the given character.

This function complements IntlChar::chr().

パラメータ

character

コードポイントを表す int 型の値 (例: U+2603 SNOWMAN を表す 0x2603)、あるいは UTF-8 文字列としてエンコードされた文字 (例: "\u{2603}")。

返り値

Returns the Unicode code point value as an integer.

例1 さまざまなコードポイントの例

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

上の例の出力は以下となります。

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

参考

  • IntlChar::chr() - Return Unicode character by code point value
  • mb_ord() - 文字の Unicode コードポイントを取得する
  • ord() - 文字列の先頭バイトを、0 から 255 までの値に変換する

add a note add a note

User Contributed Notes

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