PHP | IntlChar::isalpha() Function
Last Updated :
21 Jun, 2021
The IntlChar::isalpha() function is an inbuilt function in PHP which is used to check the given input is an alphanumeric character or not.
Syntax:
bool IntlChar::isalpha( $codepoint )
Parameters: The IntlChar::isalpha() function accept single parameter $codepoint which is mandatory. The input parameter is an integer value or character, which is encoded as a UTF-8 string.
Return Value: If $codepoint is an alphanumeric character then it returns True, otherwise return False.
Below programs illustrate the IntlChar::isalpha() function in PHP:
Program 1:
PHP
<?php
var_dump(IntlChar::isalpha( "G" ));
var_dump(IntlChar::isalpha( "G\n" ));
var_dump(IntlChar::isalpha( "Geeksforgeeks" ));
var_dump(IntlChar::isalpha( "2018" ));
var_dump(IntlChar::isalpha( "5" ));
?>
|
Output:
bool(true)
NULL
NULL
NULL
bool(false)
Program 2:
PHP
<?php
$arr = array ( "G" , "GeeksforGeeks" , "^" , "1001" , "6" , "\u{2018}" );
foreach ( $arr as $val ){
var_dump(IntlChar::isalpha( $val ));
}
?>
|
Output:
bool(true)
NULL
bool(false)
NULL
bool(false)
bool(false)
Related Articles:
Reference: http://php.net/manual/en/intlchar.isalpha.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...