PHP | IntlChar::isalnum () Function
Last Updated :
05 Feb, 2021
The IntlChar::isalnum() function is an inbuilt function in PHP which is used to check the given input is an alphanumeric character (Digit or Letter) or not. It returns TRUE for characters with general categories “L” (letters) and “Nd” (decimal digit numbers).
Syntax:
bool IntlChar::isalnum( $codepoint )
Parameters: This function accepts single parameter $codepoint which is mandatory. The input parameter is an integer values or character, which is encoded as a UTF-8 string.
Return Value: If $codepoint is alphanumeric character then it returns True, otherwise returns False.
Program 1:
PHP
<?php
var_dump(IntlChar::isalnum( "D" ));
var_dump(IntlChar::isalnum( "Geeksforgeeks" ));
var_dump(IntlChar::isalnum( "234" ));
var_dump(IntlChar::isalnum( "*" ));
?>
|
Output:
bool(true)
NULL
NULL
bool(false)
Program 2:
PHP
<?php
$arr = array ( "4" , "20001111" , "^" , " " , "*" , "GeeksforGeeks" );
foreach ( $arr as $val ){
var_dump(IntlChar::isalnum( $val ));
}
?>
|
Output:
bool(true)
NULL
bool(false)
NULL
bool(false)
NULL
Related Articles:
Reference: http://php.net/manual/en/intlchar.isalnum.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...