Open In App

PHP | IntlChar getIntPropertyValue() Function

The IntlChar::getIntPropertyValue() function is an inbuilt function in PHP which is used to get the value for Unicode property for a code point.
Syntax: 
 

int IntlChar::getIntPropertyValue( $codepoint, $property )

Parameter: This function accepts two parameters as mentioned above and described below: 
 



Return Values: 
 

Below programs illustrate the IntlChar::getIntPropertyValue() function in PHP:
Program 1: 
 






<?php
 
// Input data is alphabet character type
var_dump(IntlChar::getIntPropertyValue("A",
        IntlChar::PROPERTY_ALPHABETIC) === 1);
 
// Input data is mirrored brackets character type
var_dump(IntlChar::getIntPropertyValue("[",
        IntlChar::PROPERTY_BIDI_MIRRORED) === 1);
 
// Input data is Space character type
var_dump(IntlChar::getIntPropertyValue(" ",
        IntlChar::PROPERTY_POSIX_BLANK) === 1);
 
// Input data is special character type
var_dump(IntlChar::getIntPropertyValue("?",
    IntlChar::PROPERTY_BLOCK) === IntlChar::BLOCK_CODE_GREEK);
 
?>

Output: 
bool(true)
bool(true)
bool(true)
bool(false)

 

Program 2: 
 




<?php
 
// Input data is alphabet character type
var_dump(IntlChar::getIntPropertyValue("A",
        IntlChar::PROPERTY_ALPHABETIC) === 1);
 
// Input data is special character type
var_dump(IntlChar::getIntPropertyValue("|",
        IntlChar::PROPERTY_BIDI_MIRRORED) === 1);
 
// Input data is special character type
var_dump(IntlChar::getIntPropertyValue("?",
    IntlChar::PROPERTY_BLOCK) === IntlChar::BLOCK_CODE_GREEK);
 
// Input data is numeric character type
var_dump(IntlChar::getIntPropertyValue("9",
        IntlChar::PROPERTY_NUMERIC_TYPE) === 1 );
 
// Input data is math character type
var_dump(IntlChar::getIntPropertyValue("=",
        IntlChar::PROPERTY_MATH) === 1 );
 
?>

Output: 
bool(true)
bool(false)
bool(false)
bool(true)
bool(true)

 

Reference: https://www.php.net/manual/en/intlchar.getintpropertyvalue.php
 


Article Tags :