array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'intlchar.isxdigit.php', 1 => 'IntlChar::isxdigit', ), 'up' => array ( 0 => 'class.intlchar.php', 1 => 'IntlChar', ), 'prev' => array ( 0 => 'intlchar.iswhitespace.php', 1 => 'IntlChar::isWhitespace', ), 'next' => array ( 0 => 'intlchar.ord.php', 1 => 'IntlChar::ord', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'pt_BR', 'path' => 'reference/intl/intlchar/isxdigit.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7, PHP 8)
IntlChar::isxdigit — Verifica se um ponto de código é um dígito hexadecimal
Determina se o ponto de código especificado é um dígito hexadecimal.
true
para caracteres com categoria geral "Nd" (números de dígitos decimais) e
também para letras latinas a-f e A-F tanto em ASCII quanto em ASCII de largura completa.
(Isto é, para letras com pontos de código 0041..0046, 0061..0066, FF21..FF26, FF41..FF46.)
É equivalente a IntlChar::digit($codepoint, 16) >= 0
.
Retorna true
se
codepoint
for um caractere hexadecimal, false
se não for. Retorna null
em caso de falha.
Exemplo #1 Testando diferentes pontos de código
<?php
var_dump(IntlChar::isxdigit("A"));
var_dump(IntlChar::isxdigit("1"));
var_dump(IntlChar::isxdigit("\u{2603}"));
?>
O exemplo acima produzirá:
bool(true) bool(true) bool(false)
Nota:
In order to narrow the definition of hexadecimal digits to only ASCII characters use:
<?php
$isASCIIHexadecimal = IntlChar::ord($codepoint) <= 0x7F && IntlChar::isxdigit($codepoint);
?>