PHP 8.1.28 Released!

mb_ord

(PHP 7 >= 7.2.0, PHP 8)

mb_ordGet Unicode code point of character

Descripción

mb_ord(string $string, ?string $encoding = null): int|false

Returns the Unicode code point value of the given character.

This function complements mb_chr().

Parámetros

string

A string

encoding

El parámetro encoding es la codificación de caracteres. Si es omitido, será usado el valor de la codificación de caracteres interna.

Valores devueltos

The Unicode code point for the first character of string o false en caso de error.

Historial de cambios

Versión Descripción
8.0.0 encoding is nullable now.

Ejemplos

<?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"));
?>

El resultado del ejemplo sería:


int(65)
int(128024)
int(128)
int(8364)

Ver también

  • mb_internal_encoding() - Establece/obtiene la codificación de caracteres interna
  • mb_chr() - Return character by Unicode code point value
  • IntlChar::ord() - Devolver el valor del punto de código de Unicode de un carácter
  • ord() - Convierte el primer byte de un string a un valor entre 0 y 255

add a note

User Contributed Notes

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