Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • PHP Tutorial
  • PHP Exercises
  • PHP Array
  • PHP String
  • PHP Calendar
  • PHP Filesystem
  • PHP Math
  • PHP Programs
  • PHP Array Programs
  • PHP String Programs
  • PHP Interview Questions
  • PHP GMP
  • PHP IntlChar
  • PHP Image Processing
  • PHP DsSet
  • PHP DsMap
  • PHP Formatter
  • Web Technology
Open In App
Next Article:
PHP | IntlChar::chr() Function
Next article icon

PHP IntlChar::charName() Function

Last Updated : 24 Apr, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

PHP IntlChar::charName() function is an inbuilt function in PHP used to retrieve the name of a Unicode character.

Syntax:

string IntlChar::charName( $codepoint [, $nameChoice =  IntlChar::UNICODE_CHAR_NAME] )

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

  • $codepoint: This parameter is a character or integer value, which is encoded as a UTF-8 string.
  • $nameChoice: The $nameChoice parameter is satisfied one of the following constant conditions:
    • IntlChar::UNICODE_CHAR_NAME (default)
    • IntlChar::CHAR_NAME_ALIAS
    • IntlChar::CHAR_NAME_CHOICE_COUNT
    • IntlChar::UNICODE_10_CHAR_NAME
    • IntlChar::EXTENDED_CHAR_NAME

Note: The resulting character name is a modern name with Unicode version 1.0 and the name contains "invariant" characters A-Z, 0-9, " ", and '-' and depends on its $nameChoice parameter.

Return Value: This function returns the corresponding name of input data. If there is no name of the character then return the empty string.

The below examples illustrate the IntlChar::charName() Function in PHP.

Example 1:

php
<?php // PHP code to illustrate // IntlChar::charName ()function  // Input asterisk symbol of codepoint value  // with constraint UNICODE_CHAR_NAME  var_dump(IntlChar::charName("*")); var_dump(IntlChar::charName("*", IntlChar::UNICODE_CHAR_NAME));  // Input start bracket symbol of codepoint value  // with constraint UNICODE_10_CHAR_NAME  var_dump(IntlChar::charName("(")); var_dump(IntlChar::charName("(", IntlChar::UNICODE_10_CHAR_NAME));  // Input ampersand symbol of codepoint value  // with constraint EXTENDED_CHAR_NAME var_dump(IntlChar::charName("&")); var_dump(IntlChar::charName("&", IntlChar::EXTENDED_CHAR_NAME));  // Input ^ symbol of codepoint value  // with constraint CHAR_NAME_ALIAS var_dump(IntlChar::charName("^")); var_dump(IntlChar::charName("^", IntlChar::CHAR_NAME_ALIAS ));  // Input tilde symbol of codepoint value  //and with constraint CHAR_NAME_CHOICE_COUNT var_dump(IntlChar::charName("`")); var_dump(IntlChar::charName("`", IntlChar::CHAR_NAME_CHOICE_COUNT));  // Input space of codepoint value var_dump(IntlChar::charName(" "));  // Input space in codepoint value with  // UNICODE_CHAR_NAME condition var_dump(IntlChar::charName(" ", IntlChar::UNICODE_CHAR_NAME));  // Input Alphabet both Capital and Small character // condition EXTENDED_CHAR_NAME // and UNICODE_10_CHAR_NAME var_dump(IntlChar::charName("R")); var_dump(IntlChar::charName("r")); var_dump(IntlChar::charName("R", IntlChar::EXTENDED_CHAR_NAME));  // Input int codepoint value var_dump(IntlChar::charName("10")); var_dump(IntlChar::charName("7"));  // Input Null codepoint value var_dump(IntlChar::charName("\u{0000}"));  ?> 

Output:

string(8) "ASTERISK"  string(8) "ASTERISK"   string(16) "LEFT PARENTHESIS"  string(0) ""   string(9) "AMPERSAND"  string(9) "AMPERSAND"   string(17) "CIRCUMFLEX ACCENT"  string(0) ""   string(12) "GRAVE ACCENT"  NULL   string(5) "SPACE"  string(5) "SPACE"   string(22) "LATIN CAPITAL LETTER R"  string(20) "LATIN SMALL LETTER R"  string(22) "LATIN CAPITAL LETTER R"   NULL  string(11) "DIGIT SEVEN"   string(0) "" 

Example 2:

php
<?php  // PHP code to illustrate // IntlChar::charName() function  // Declare an array $arr $arr = array("G", ".", "8", "/", "000", "\t");  // Loop run for every array element foreach ($arr as $val){          // Check each element as code point data     var_dump(IntlChar::charName($val)); } ?> 

Output:

string(22) "LATIN CAPITAL LETTER G"  string(9) "FULL STOP"  string(11) "DIGIT EIGHT"  string(7) "SOLIDUS"  NULL  string(0) "" 

Related Articles:

  • IntlChar::charDigitValue() Function
  • IntlChar::isalpha() Function
  • IntlChar::iscntrl() Function

Reference: http://php.net/manual/en/intlchar.charname.php


Next Article
PHP | IntlChar::chr() Function
author
jit_t
Improve
Article Tags :
  • Web Technologies
  • PHP
  • PHP-function
  • PHP-Intl

Similar Reads

  • PHP | IntlChar::charAge() Function
    The IntlChar::charAge() function is an inbuilt function in PHP which is used to calculate the age of code point. Where the age is Unicode version when the code point was first designated or assigned a character. This can be useful to avoid emitting code points to receiving processes that do not acce
    2 min read
  • PHP | IntlChar charFromName() Function
    The IntlChar::charFromName() function is an inbuilt function in PHP which is used to find Unicode character by name and returns the code point value. If Unicode character name does not match to a code point, then it returns NULL. Syntax: int IntlChar::charFromName( $characterName, $nameChoice = Intl
    2 min read
  • PHP | IntlChar enumCharNames() Function
    The IntlChar::enumCharNames() function is an inbuilt function in PHP which is used to give a catalog of all the assigned Unicode characters that are available within a range. The list will have the Unicode characters that are available between the start code points (start inclusive) and the limit co
    2 min read
  • PHP | IntlChar::chr() Function
    The IntlChar::chr() function is an inbuilt function in PHP which is used to check whether the given input character is Unicode code point value or not. It returns Unicode character by code point value.Syntax: string IntlChar::chr( $codepoint ) Parameters: This function accepts a single parameter $co
    2 min read
  • PHP | IntlChar charType() Function
    The IntlChar::charType() function is an inbuilt function in PHP which is used to get the general category value for a code point. This function returns the general category value for the code point. Syntax: int IntlChar::charType ( $codepoint ) Parameters: This function accepts a single parameter $c
    2 min read
  • PHP | IntlChar::charMirror() Function
    The IntlChar::charMirror() function is an inbuilt function in PHP which is used to find the "mirror-image" character from the given input code point character, which maps the specified character. Syntax: mixed IntlChar::charMirror( $codepoint ) Parameters: This function accepts a single parameter $c
    2 min read
  • PHP | IntlChar::charDigitValue() Function
    The IntlChar::charDigitValue() function is an inbuilt function in PHP which is used to return the decimal digit value from a decimal digit character. Where the general category decimal digit numbers and "Nd" is Numeric_Type of Decimal.Syntax:   int IntlChar::charDigitValue( $codepoint ) Parameters:
    2 min read
  • PHP | IntlChar charDirection() Function
    The IntlChar::charDirection() function is an inbuilt function in PHP which is used to get the bidirectional category value for a code point. It returns the bidirectional category value for the code point, which is used in the Unicode bidirectional algorithm. Syntax: int IntlChar::charDirection ( $co
    2 min read
  • PHP | IntlChar foldCase() Function
    The IntlChar::foldCase() function is an inbuilt function in PHP which is used to perform case folding on a code point. Case folding means the given character is mapped to its equivalent lowercase characters.Syntax: mixed IntlChar::foldCase( $codepoint, $options = IntlChar::FOLD_CASE_DEFAULT ) Parame
    1 min read
  • PHP | IntlChar enumCharTypes() Function
    The IntlChar::enumCharTypes() function is an inbuilt function in PHP which is used to give a catalog of all the code points with their Unicode general categories. All the cataloging happens very efficiently of all the code points. For enumerating all the assigned code points and building data struct
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences