The IntlChar::isxdigit() function checks whether the given input character is a hexadecimal digit or not. The following are the hexadecimal digits −
Digit numbers (0 – 9)
Letters (a – f) and (A – F)
\u{0041} to \u{0046},
\u{0061} to \u{0066},
\u{FF21} to \u{FF26}
\u{FF41} to \u{FF46}).
Syntax
IntlChar::isxdigit( val )
Parameters
val − An integer values or character encoded as a UTF-8 string.
Return
The IntlChar::isxdigit() function returns TRUE if the val is a hexadecimal digit.
Example
The following is an example −
var_dump(IntlChar::isxdigit("10"));
echo "<br>";
// Input data is character type
var_dump(IntlChar::isxdigit("A"));
echo "<br>";
var_dump(IntlChar::isxdigit("a"));
echo "<br>";Output
The following is the output −
bool(true) NULL bool(true)
Example
Let us see another example −
<?php
var_dump(IntlChar::isxdigit("u{0041}"));
echo "<br>";
var_dump(IntlChar::isxdigit("k"));
echo "<br>";
var_dump(IntlChar::isxdigit("9"));
echo "<br>";
?>Output
The following is the output −
bool(true) bool(false) bool(true)