Saturday, December 13, 2025
HomeLanguagesPHP | IntlChar::isalpha() Function

PHP | IntlChar::isalpha() Function

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
// PHP code to illustrate IntlChar::isalpha()
// function
 
// Input data is character type
var_dump(IntlChar::isalpha("G"));
 
// Input data is string type
var_dump(IntlChar::isalpha("G\n"));
 
// Input data is string type
var_dump(IntlChar::isalpha("Geeksforneveropen"));
 
// Input data is number
var_dump(IntlChar::isalpha("2018"));
 
// Input data is single digit
var_dump(IntlChar::isalpha("5"));
?>


Output: 

bool(true) 
NULL 
NULL 
NULL 
bool(false)

Program 2:

PHP




<?php
// PHP code to illustrate IntlChar::isalpha()
   
// Declare an array $arr
$arr = array("G", "neveropen", "^", "1001", "6", "\u{2018}");
  
// Loop run for every array element
foreach ($arr as $val){
      
    // Check each element as code point data
    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
 

RELATED ARTICLES

1 COMMENT

Most Popular

Dominic
32447 POSTS0 COMMENTS
Milvus
105 POSTS0 COMMENTS
Nango Kala
6816 POSTS0 COMMENTS
Nicole Veronica
11952 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12031 POSTS0 COMMENTS
Shaida Kate Naidoo
6951 POSTS0 COMMENTS
Ted Musemwa
7202 POSTS0 COMMENTS
Thapelo Manthata
6898 POSTS0 COMMENTS
Umr Jansen
6882 POSTS0 COMMENTS