PHP | IntlChar getPropertyValueEnum() Function

The IntlChar getPropertyValueEnum() function is an inbuilt function in PHP which is used to get the property value form the given value.

Syntax:

int IntlChar::getPropertyValueEnum( $property, $name )

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



  • $property: It stores the IntlChar::PROPERTY_* constants.
  • $name: It stores the name value which to be stored.

Return Value: If the given name does not match to any property or the property is invalid then it returns the corresponding value integer, or IntlChar::PROPERTY_INVALID_CODE.

Below programs illustrate the IntlChar::getPropertyValueEnum() function in PHP:

Program:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP program to implement IntlChar::getPropertyValueEnum() function
  
// Unicode property constant and it corresponding name is same
var_dump(IntlChar::getPropertyValueEnum(IntlChar::PROPERTY_BIDI_CLASS,
        'RIGHT_TO_LEFT') === IntlChar::CHAR_DIRECTION_RIGHT_TO_LEFT);
  
// Unicode property constant and it corresponding name is same
var_dump(IntlChar::getPropertyValueEnum(IntlChar::PROPERTY_BLOCK,
        'greek') === IntlChar::BLOCK_CODE_GREEK);
  
// Unicode property constant and it name is corresponding name is same
var_dump(IntlChar::getPropertyValueEnum(IntlChar::PROPERTY_BIDI_CLASS,
        'some made-up string') === IntlChar::PROPERTY_INVALID_CODE);
  
  
// Unicode property constant and it name is not matching so it return false
var_dump(IntlChar::getPropertyValueEnum(IntlChar::PROPERTY_BIDI_CLASS,
        'RIGHT_TO_LEFT') === IntlChar::BLOCK_CODE_GREEK);
  
?>

chevron_right


Output:

bool(true)
bool(true)
bool(true)
bool(false)

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



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.