PHP | IntlChar charType() Function Last Updated : 27 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The IntlChar::charType() function is an inbuilt function in PHP which is used to get the general category value for a code point. This function returns the general category value for the code point. Syntax: int IntlChar::charType ( $codepoint ) Parameters: This function accepts a single parameter $codepoint which is mandatory. The $codepoint value is an integer values or character, which is encoded as a UTF-8 string. Return Value: This function returns the general category content which are listed below: IntlChar::CHAR_CATEGORY_UNASSIGNED IntlChar::CHAR_CATEGORY_GENERAL_OTHER_TYPES IntlChar::CHAR_CATEGORY_UPPERCASE_LETTER IntlChar::CHAR_CATEGORY_LOWERCASE_LETTER IntlChar::CHAR_CATEGORY_TITLECASE_LETTER IntlChar::CHAR_CATEGORY_MODIFIER_LETTER IntlChar::CHAR_CATEGORY_OTHER_LETTER IntlChar::CHAR_CATEGORY_NON_SPACING_MARK IntlChar::CHAR_CATEGORY_ENCLOSING_MARK IntlChar::CHAR_CATEGORY_COMBINING_SPACING_MARK IntlChar::CHAR_CATEGORY_DECIMAL_DIGIT_NUMBER IntlChar::CHAR_CATEGORY_LETTER_NUMBER IntlChar::CHAR_CATEGORY_OTHER_NUMBER IntlChar::CHAR_CATEGORY_SPACE_SEPARATOR IntlChar::CHAR_CATEGORY_LINE_SEPARATOR IntlChar::CHAR_CATEGORY_PARAGRAPH_SEPARATOR IntlChar::CHAR_CATEGORY_CONTROL_CHAR IntlChar::CHAR_CATEGORY_FORMAT_CHAR IntlChar::CHAR_CATEGORY_PRIVATE_USE_CHAR IntlChar::CHAR_CATEGORY_SURROGATE IntlChar::CHAR_CATEGORY_DASH_PUNCTUATION IntlChar::CHAR_CATEGORY_START_PUNCTUATION IntlChar::CHAR_CATEGORY_END_PUNCTUATION IntlChar::CHAR_CATEGORY_CONNECTOR_PUNCTUATION IntlChar::CHAR_CATEGORY_OTHER_PUNCTUATION IntlChar::CHAR_CATEGORY_MATH_SYMBOL IntlChar::CHAR_CATEGORY_CURRENCY_SYMBOL IntlChar::CHAR_CATEGORY_MODIFIER_SYMBOL IntlChar::CHAR_CATEGORY_OTHER_SYMBOL IntlChar::CHAR_CATEGORY_INITIAL_PUNCTUATION IntlChar::CHAR_CATEGORY_FINAL_PUNCTUATION IntlChar::CHAR_CATEGORY_CHAR_CATEGORY_COUNT Below programs illustrate the IntlChar::charType() function in PHP: Program 1: php <?php // PHP code to illustrate IntlChar::charType() // function // Input data is character type var_dump(IntlChar::charType("A") === IntlChar::CHAR_CATEGORY_UPPERCASE_LETTER); // Input data is character type var_dump(IntlChar::charType(".") === IntlChar::CHAR_CATEGORY_OTHER_PUNCTUATION); // Input data is character type var_dump(IntlChar::charType("\t") === IntlChar::CHAR_CATEGORY_CONTROL_CHAR); // Input data is unicode character var_dump(IntlChar::charType("\u{2603}") === IntlChar::CHAR_CATEGORY_OTHER_SYMBOL); // Input data is string type var_dump(IntlChar::charType("ABC") === IntlChar::CHAR_CATEGORY_OTHER_PUNCTUATION); // Input data is character type var_dump(IntlChar::charType("\n") === IntlChar::CHAR_CATEGORY_CONTROL_CHAR); ?> Output: bool(true) bool(true) bool(true) bool(true) bool(false) bool(true) Program 2: php <?php // PHP code to illustrate IntlChar::charType() // function // Input data is character type var_dump(IntlChar::charType("A")); // Input data is character type var_dump(IntlChar::charType(".")); // Input data is character type var_dump(IntlChar::charType("\t")); // Input data is unicode character var_dump(IntlChar::charType("\u{2603}")); // Input data is string type var_dump(IntlChar::charType("ABC")); // Input data is character type var_dump(IntlChar::charType("\n")); ?> Output: int(1) int(23) int(15) int(27) NULL int(15) Related Articles: PHP | IntlChar::charDigitValue() Function PHP | IntlChar isMirrored() Function PHP | IntlChar::isspace() Function Reference: http://php.net/manual/en/intlchar.chartype.php Comment More infoAdvertise with us Next Article PHP IntlChar::charName() 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 enumCharTypes() Function The IntlChar::enumCharTypes() function is an inbuilt function in PHP which is used to give a catalog of all the code points with their Unicode general categories. All the cataloging happens very efficiently of all the code points. For enumerating all the assigned code points and building data struct 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::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::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::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 charFromName() Function The IntlChar::charFromName() function is an inbuilt function in PHP which is used to find Unicode character by name and returns the code point value. If Unicode character name does not match to a code point, then it returns NULL. Syntax: int IntlChar::charFromName( $characterName, $nameChoice = Intl 2 min read Like