Tutorialspoint.dev

PHP | IntlChar::isUAlphabetic() Function

The IntlChar::isUAlphabetic() function is an inbuilt function in PHP which is used to check whether the given input character is an Alphabetic Unicode character or not.

Syntax:

bool IntlChar::isUAlphabetic( $codepoint )

Parameters: This function accepts single parameter $codepoint which is mandotary. The input parameter is an integer or character, which is encoded as a UTF-8 string.

Return Value: If $codepoint is an Alphabetic Unicode Character then returns True, otherwise return False.

Below programs illustrate the IntlChar::isUAlphabetic() function in PHP:



Program 1:

<?php
// PHP program to illustrate
// IntlChar::isUAlphabetic() function
   
// Input data is character type
var_dump(IntlChar::isUAlphabetic("G"));
echo "<br>";
   
// Input data is string type
var_dump(IntlChar::isUAlphabetic("B "));
echo "<br>";
    
// Input data is string type
var_dump(IntlChar::isUAlphabetic("Geeksforgeeks"));
echo "<br>";
    
// Input data is number(multiple digit)
var_dump(IntlChar::isUAlphabetic("2018"));
echo "<br>";
    
// Input data is single digit
var_dump(IntlChar::isUAlphabetic("9"));
echo "<br>";
  
// Input data is floating point number
var_dump(IntlChar::isUAlphabetic("10.99"));
   
?>

/div>

Output:

bool(true)
NULL
NULL
NULL
bool(false)
NULL

Program 2:

<?php
// PHP code to illustrate isUAlphabetic()
    
// Declare an array $arr
$arr = array("Z", "291", "^", "  ", "*", "Sudo Placement");
   
// Loop run for every array element
foreach ($arr as $val){
       
    // Check each element as code point data
    var_dump(IntlChar::isUAlphabetic($val));
    echo "<br>";
}
?>

Output:

bool(true)
NULL
bool(false)
NULL
bool(false)
NULL

Related Articles:

Reference: http://php.net/manual/en/intlchar.isualphabetic.php



This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment

code

0 Comments

load comments

Subscribe to Our Newsletter