PHP | IntlChar charDirection() Function Last Updated : 27 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 ( $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 bidirectional category value which are listed below: IntlChar::CHAR_DIRECTION_LEFT_TO_RIGHT IntlChar::CHAR_DIRECTION_RIGHT_TO_LEFT IntlChar::CHAR_DIRECTION_EUROPEAN_NUMBER IntlChar::CHAR_DIRECTION_EUROPEAN_NUMBER_SEPARATOR IntlChar::CHAR_DIRECTION_EUROPEAN_NUMBER_TERMINATOR IntlChar::CHAR_DIRECTION_ARABIC_NUMBER IntlChar::CHAR_DIRECTION_COMMON_NUMBER_SEPARATOR IntlChar::CHAR_DIRECTION_BLOCK_SEPARATOR IntlChar::CHAR_DIRECTION_SEGMENT_SEPARATOR IntlChar::CHAR_DIRECTION_WHITE_SPACE_NEUTRAL IntlChar::CHAR_DIRECTION_OTHER_NEUTRAL IntlChar::CHAR_DIRECTION_LEFT_TO_RIGHT_EMBEDDING IntlChar::CHAR_DIRECTION_LEFT_TO_RIGHT_OVERRIDE IntlChar::CHAR_DIRECTION_RIGHT_TO_LEFT_ARABIC IntlChar::CHAR_DIRECTION_RIGHT_TO_LEFT_EMBEDDING IntlChar::CHAR_DIRECTION_RIGHT_TO_LEFT_OVERRIDE IntlChar::CHAR_DIRECTION_POP_DIRECTIONAL_FORMAT IntlChar::CHAR_DIRECTION_DIR_NON_SPACING_MARK IntlChar::CHAR_DIRECTION_BOUNDARY_NEUTRAL IntlChar::CHAR_DIRECTION_FIRST_STRONG_ISOLATE IntlChar::CHAR_DIRECTION_LEFT_TO_RIGHT_ISOLATE IntlChar::CHAR_DIRECTION_RIGHT_TO_LEFT_ISOLATE IntlChar::CHAR_DIRECTION_POP_DIRECTIONAL_ISOLATE IntlChar::CHAR_DIRECTION_CHAR_DIRECTION_COUNT Below programs illustrate the IntlChar::charDirection() function in PHP: Program 1: PHP <?php // PHP code to illustrate IntlChar::charDirection() // function // Input data is character type var_dump(IntlChar::charDirection("A") === IntlChar::CHAR_DIRECTION_LEFT_TO_RIGHT); // Input data is unicode character var_dump(IntlChar::charDirection("\u{05E9}") === IntlChar::CHAR_DIRECTION_RIGHT_TO_LEFT); // Input data is character type var_dump(IntlChar::charDirection("+") === IntlChar::CHAR_DIRECTION_EUROPEAN_NUMBER_SEPARATOR); // Input data is character type var_dump(IntlChar::charDirection(".") === IntlChar::CHAR_DIRECTION_COMMON_NUMBER_SEPARATOR); // Input data is string type var_dump(IntlChar::charDirection("ABC") === IntlChar::CHAR_DIRECTION_RIGHT_TO_LEFT); // Input data is character type var_dump(IntlChar::charDirection("c") === IntlChar::CHAR_DIRECTION_RIGHT_TO_LEFT); // Input data is character type var_dump(IntlChar::charDirection("O") === IntlChar::CHAR_DIRECTION_LEFT_TO_RIGHT); ?> Output: bool(true) bool(true) bool(true) bool(true) bool(false) bool(false) bool(true) Program 2: php <?php // PHP code to illustrate IntlChar::charDirection() // function // Input data is character type var_dump(IntlChar::charDirection("A")); // Input data is unicode character var_dump(IntlChar::charDirection("\u{05E9}")); // Input data is character type var_dump(IntlChar::charDirection("+")); // Input data is character type var_dump(IntlChar::charDirection(".")); // Input data is string type var_dump(IntlChar::charDirection("ABC")); // Input data is character type var_dump(IntlChar::charDirection("c")); // Input data is character type var_dump(IntlChar::charDirection("O")); ?> Output: int(0) int(1) int(3) int(6) NULL int(0) int(0) Related Articles: PHP | IntlChar::islower() Function PHP | IntlChar::iscntrl() Function Reference: http://php.net/manual/en/intlchar.chardirection.php Comment More infoAdvertise with us Next Article PHP | IntlChar::chr() 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::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 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 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::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::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 charType() Function 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 $c 2 min read Like