![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 −
<?php var_dump(IntlChar::charName("&")); echo "<br>"; 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 −
<?php var_dump(IntlChar::charName("K")); echo "<br>"; 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 −
<?php var_dump(IntlChar::charName("5")); echo "<br>"; var_dump(IntlChar::charName("10")); echo "<br>"; var_dump(IntlChar::charName("e")); echo "<br>"; 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