PHP | IntlChar digit() function Last Updated : 27 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The IntlChar::digit() function is an inbuilt function in PHP which is used to get the decimal digit value of a code point for a given radix. This function returns the decimal digit value of the code point in the specified radix. Syntax: int IntlChar::digit( $codepoint, $radix ) Parameters: This function accepts two parameters as mentioned above and described below: $codepoint: The value of $codepoint is an integer or character, which is encoded as a UTF-8 string. $radix: It is optional parameter. Its default value is 10. Return Value: This function returns the number represented by the character in the given radix, or False if there is no value or if the value exceeds the radix. Note: Valid and invalid function argument: If both $radix or $digit is not valid then return NULL. The $radix argument is valid if its value lies between $radix >= 2 and $radix <= 36. The digit is valid if its value is 0 <= digit < radix. The character has a decimal digit value. This characters comes under general category Nd(decimal digit numbers) and a Numeric_Type of Decimal. The character is uppercase Latin letters in between 'A' to 'Z'. Then the value of character is c-'A'+10. The character is lowercase Latin letters in between 'a' to 'z'. Then the value of character is ch-'a'+10. Latin letters from both the ASCII range (0061..007A, 0041..005A) as well as from the Full width ASCII range (FF41..FF5A, FF21..FF3A) are recognized. Below programs illustrate the IntlChar::digit() function in PHP: Program 1: php <?php // PHP code to illustrate IntlChar::digit() // function // Input data is single digit var_dump(IntlChar::digit("6")); // Input data is single digit var_dump(IntlChar::digit("3")); // Input data is character type var_dump(IntlChar::digit("A")); // // Input data is character type with base var_dump(IntlChar::digit("P", 16)); // // Input data is character type with base var_dump(IntlChar::digit("9", 2)); ?> Output: int(6) int(3) bool(false) bool(false) bool(false) Program 2: php <?php // PHP code to illustrate IntlChar::digit() // Declare an array $arr $arr = array("G", "GeeksforGeeks", "^", "1001", "6", "\n", "\n\n", "\t"); // Loop run for every array element foreach ($arr as $val){ // Check each element as code point data var_dump(IntlChar::digit($val)); } ?> Output: bool(false) NULL bool(false) NULL int(6) bool(false) NULL bool(false) Related Articles: PHP | IntlChar::isdigit() Function PHP | IntlChar::forDigit() Function PHP | IntlChar::charDigitValue() Function Reference: http://php.net/manual/en/intlchar.digit.php Comment More infoAdvertise with us Next Article PHP | IntlChar digit() function V vijay_raj Follow Improve Article Tags : Misc Web Technologies PHP PHP-function PHP-Intl +1 More Practice Tags : Misc Similar Reads PHP | IntlChar::forDigit() Function The IntlChar::forDigit() function is an inbuilt function in PHP which is used to determines the character representation for a specific digit in the specified radix. Syntax: int IntlChar::forDigit( $digit, $radix ) Parameters: This function accepts two parameters as mentioned above and described bel 2 min read PHP | IntlChar::charDigitValue() Function The IntlChar::charDigitValue() function is an inbuilt function in PHP which is used to return the decimal digit value from a decimal digit character. Where the general category decimal digit numbers and "Nd" is Numeric_Type of Decimal.Syntax:Â Â int IntlChar::charDigitValue( $codepoint ) Parameters: 2 min read PHP | IntlChar::chr() Function The IntlChar::chr() function is an inbuilt function in PHP which is used to check whether the given input character is Unicode code point value or not. It returns Unicode character by code point value.Syntax: string IntlChar::chr( $codepoint ) Parameters: This function accepts a single parameter $co 2 min read PHP | IntlChar::charAge() Function The IntlChar::charAge() function is an inbuilt function in PHP which is used to calculate the age of code point. Where the age is Unicode version when the code point was first designated or assigned a character. This can be useful to avoid emitting code points to receiving processes that do not acce 2 min read PHP IntlChar::ord() Function The IntlChar::ord() function is an inbuilt function in PHP which is used to return the Unicode code point value of the given character. Syntax: int IntlChar::ord( $character ) Parameters: This function accepts a single parameter $character which is mandatory. This parameter is a Unicode character. R 2 min read PHP | IntlChar charDirection() Function The IntlChar::charDirection() function is an inbuilt function in PHP which is used to get the bidirectional category value for a code point. It returns the bidirectional category value for the code point, which is used in the Unicode bidirectional algorithm. Syntax: int IntlChar::charDirection ( $co 2 min read PHP | IntlChar foldCase() Function The IntlChar::foldCase() function is an inbuilt function in PHP which is used to perform case folding on a code point. Case folding means the given character is mapped to its equivalent lowercase characters.Syntax: mixed IntlChar::foldCase( $codepoint, $options = IntlChar::FOLD_CASE_DEFAULT ) Parame 1 min read PHP | IntlChar::charMirror() Function The IntlChar::charMirror() function is an inbuilt function in PHP which is used to find the "mirror-image" character from the given input code point character, which maps the specified character. Syntax: mixed IntlChar::charMirror( $codepoint ) Parameters: This function accepts a single parameter $c 2 min read PHP IntlChar::charName() Function PHP IntlChar::charName() function is an inbuilt function in PHP used to retrieve the name of a Unicode character. Syntax: string IntlChar::charName( $codepoint [, $nameChoice = IntlChar::UNICODE_CHAR_NAME] ) Parameters: This function accepts two parameters as mentioned above and described below: $co 2 min read PHP IntlChar::isbase() Function PHP IntlChar::isbase() function is an inbuilt function in PHP that is used to check whether the given input data is a base character or not. If the specified code point is a base character then it returns TRUE for general categories "L" (Letters), "N" (numbers), "Mc" (spacing combining marks), and " 2 min read Like