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 $codepoint which is mandatory. The input parameter is a character or interger value, which is encoded as a UTF-8 string.
Return Value: In True cases, the $codepoint string contain the single character, which is specified by the Unicode code point value, otherwise return NULL.
Below programs illustrate the IntlChar::chr() function in PHP:
Program 1:
<?php // PHP function to illustrate // the use of IntlChar::chr() // Input int codepoint value var_dump(IntlChar::chr(" ")); // Input int codepoint value var_dump(IntlChar::chr(101)); // Input char codepoint value var_dump(IntlChar::chr("G")); // Input char codepoint value var_dump(IntlChar::chr("Geeks")); // Input Symbolic codepoint value var_dump(IntlChar::chr("$")); // Input Symbolic codepoint value var_dump(IntlChar::chr("#")); // Input Symbolic codepoint value var_dump(IntlChar::chr("@")); ?> |
Output:
string(1) " " string(1) "e" string(1) "G" NULL string(1) "$" string(1) "#" string(1) "@"
Program 2:
<?php // PHP function to illustrate the // use of IntlChar::chr // Declare an array with // different codepoint value $arr = array("D", ("E"), 77, 123, 65, 97, ); // For loop condition to check // each character through function foreach ($arr as $val) { // Check each element as code point data var_dump(IntlChar::chr($val)); } ?> |
Output:
string(1) "D"
string(1) "E"
string(1) "M"
string(1) "{"
string(1) "A"
string(1) "a"
Related Articles:
Reference: http://php.net/manual/en/intlchar.chr.php
Recommended Posts:
- How to get the function name inside a function in PHP ?
- PHP 5 vs PHP 7
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
- How to import config.php file in a PHP script ?
- PHP | imagecreatetruecolor() Function
- PHP | fpassthru( ) Function
- PHP | ImagickDraw getTextAlignment() Function
- PHP | Ds\Sequence last() Function
- PHP | Imagick floodFillPaintImage() Function
- Function to escape regex patterns before applied in PHP
- PHP | array_udiff_uassoc() Function
- PHP | geoip_continent_code_by_name() Function
- PHP | GmagickPixel setcolor() function
- PHP | opendir() Function
- PHP | cal_to_jd() Function
- PHP | stream_get_transports() Function
- PHP | Ds\Deque pop() Function
- PHP | SimpleXMLElement children() Function
- PHP | array_intersect_ukey() Function
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.
Improved By : Akanksha_Rai

