PHP | IntlChar hasBinaryProperty() function
The IntlChar::hasBinaryProperty() function is an inbuilt function in PHP which is used to checks a binary Unicode property for a code point.
Syntax:
bool IntlChar::hasBinaryProperty( $codepoint, $property )
Parameters: This function accepts two parameters as mentioned above and described below:
- $codepoint: The $codepoint value is an integer values or character, which is encoded as a UTF-8 string.
- $property: This stores the IntlChar::PROPERTY_* constants.
Return Value: This function returns boolean value (true or false) based on binary Unicode property.
Below programs illustrate the IntlChar::hasBinaryProperty() function in PHP:
Program 1:
<?php // PHP function to illustrate the use of // IntlChar::hasBinaryProperty() function // Input data is character type var_dump(IntlChar::hasBinaryProperty("G", IntlChar::PROPERTY_ALPHABETIC)); // Input data is string type var_dump(IntlChar::hasBinaryProperty("Geeks", IntlChar::PROPERTY_ALPHABETIC)); // Input data is mirrored bracket character type var_dump(IntlChar::hasBinaryProperty("}", IntlChar::PROPERTY_BIDI_MIRRORED)); // Input data is character type var_dump(IntlChar::hasBinaryProperty("%", IntlChar::PROPERTY_BIDI_MIRRORED)); ?> |
bool(true) NULL bool(true) bool(false)
Program 2:
<?php // PHP function to illustrate the use of // IntlChar::hasBinaryProperty() function // Declare an array $arr $arr = array("A", "{", "^", ")", "6", "Geeks", "))"); // Loop run for every array element foreach ($arr as $val){ // Check each element as code point data var_dump(IntlChar::hasBinaryProperty($val, IntlChar::PROPERTY_BIDI_MIRRORED)); } ?> |
bool(false) bool(true) bool(false) bool(true) bool(false) NULL NULL
Reference: https://www.php.net/manual/en/intlchar.hasbinaryproperty.php
Recommended Posts:
- PHP | IntlChar::ord() Function
- PHP | IntlChar::chr() Function
- PHP | IntlChar getUnicodeVersion() Function
- PHP | IntlChar getPropertyName() Function
- PHP | IntlChar::isIDPart() Function
- PHP | IntlChar getFC_NFKC_Closure() Function
- PHP | IntlChar getNumericValue() Function
- PHP | IntlChar foldCase() Function
- PHP | IntlChar charFromName() Function
- PHP | IntlChar::isbase() Function
- PHP | IntlChar::isalpha() Function
- PHP | IntlChar::iscntrl() Function
- PHP | IntlChar getIntPropertyMinValue() Function
- PHP | IntlChar isgraph() Function
- PHP | IntlChar isMirrored() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



