Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
IntlChar::charName() function in PHP
The IntlChar::charName()function gets the name of a Unicode character.
Syntax
string IntlChar::charName( val [, choice = IntlChar::UNICODE_CHAR_NAME] )
Parameters
val − An integer value or character encoded as UTF-8 string.
-
choice − The following are the constant conditions −
IntlChar::UNICODE_CHAR_NAME
IntlChar::CHAR_NAME_ALIAS
IntlChar::CHAR_NAME_CHOICE_COUNT
IntlChar::UNICODE_10_CHAR_NAME
IntlChar::EXTENDED_CHAR_NAME
Return
The IntlChar::charName() function returns the corresponding name of input data. For no name of character, an empty string is returned.
Example
The following is an example −
";
var_dump(IntlChar::charName("&", IntlChar::EXTENDED_CHAR_NAME));
?>
Output
The following is the output −
string(9) "AMPERSAND" string(9) "AMPERSAND"
Example
Let us see another example −
";
var_dump(IntlChar::charName("K", IntlChar::EXTENDED_CHAR_NAME));
?>
Output
The following is the output −
string(22) "LATIN CAPITAL LETTER K" string(22) "LATIN CAPITAL LETTER K"
Example
Let us see one more example with a different input value −
";
var_dump(IntlChar::charName("10"));
echo "
";
var_dump(IntlChar::charName("e"));
echo "
";
var_dump(IntlChar::charName("}"));
?>
Output
The following is the output −
string(10) "DIGIT FIVE" NULL string(20) "LATIN SMALL LETTER E" string(19) "RIGHT CURLY BRACKET"
Advertisements
