mb_ord
PHP function
Edit on GitHub ✎
(PHP 7 >= 7.2.0, PHP 8)
Get Unicode code point of character
Description
mb_ord(string $string, string|null $encoding = null): int|false
Returns the Unicode code point value of the given character.
This function complements mb_chr().
Parameters
stringA string
encodingParameter
Return Values
The Unicode code point for the first character of string Falseforfailure.
Changelog
| Version | Description |
|---|
Examples
A basic mb_ord() example
php
<?php
var_dump(mb_ord("A", "UTF-8"));
var_dump(mb_ord("🐘", "UTF-8"));
var_dump(mb_ord("\x80", "ISO-8859-1"));
var_dump(mb_ord("\x80", "Windows-1252"));
?>The above example will output:
output
int(65)
int(128024)
int(128)
int(8364)