The IntlChar::isalpha() function is used to check the given input is an alphanumeric character or not.
IntlChar::isalpha( $val )
val − An integer values or character encoded as a UTF-8 string.Required.
The IntlChar::isalpha() function returns TRUE if the val is alphanumeric character.
The following is an example −
<?php var_dump(IntlChar::isalpha("7")); echo "<br>"; var_dump(IntlChar::isalpha("M")); ?>
The following is the output −
bool(false) bool(true)
Let us see another example wherein we are checking for alphanumeric characters −
<?php var_dump(IntlChar::isalpha("Amit")); echo "<br>"; var_dump(IntlChar::isalpha("Jacob87876")); echo "<br>"; var_dump(IntlChar::isalpha("87876")); echo "<br>"; var_dump(IntlChar::isalpha("A")); ?>
The following is the output −
NULL NULL NULL bool(true)