The IntlChar::ord() function is an inbuilt function in PHP which is used to return the Unicode code point value of the given character.
Syntax:
int IntlChar::ord( $character )
Parameters: This function accepts a single parameter $character which is mendatory. This parameter is a Unicode character.
Return Value: It returns Unicode code point value as an integer.
Below programs illustrate the IntlChar::ord() Function in PHP:
Program 1:
<?php // PHP function to illustrate // the use of IntlChar::ord() // Input int codepoint value var_dump(IntlChar::ord("4")); // Input character codepoint value var_dump(IntlChar::ord("B")); // Input character codepoint value var_dump(IntlChar::ord("b")); //Input int codepoint value var_dump(IntlChar::ord("2018")); // Input character codepoint value var_dump(IntlChar::ord("Geeks")); // Input symbole codepoint value var_dump(IntlChar::ord("@")); // Input symbole codepoint value var_dump(IntlChar::ord("*")); // Input space codepoint value var_dump(IntlChar::ord(" ")); ?> |
Output:
int(52) int(66) int(98) NULL NULL int(64) int(42) int(32)
Program 2:
<?php // PHP function to illustrate the // use of IntlChar::ord() // Declare an array with // different codepoint value $arr = array("X", "x", "*", "8", "0", " ", "&", ")", "99", ); // For loop condition to check // each character through function foreach ($arr as $val) { // Check each element as code point data var_dump(IntlChar::ord($val)); } ?> |
Output:
int(88) int(120) int(42) int(56) int(48) int(32) int(38) int(41) NULL
Related Articles:
Reference: http://php.net/manual/en/intlchar.ord.php
Recommended Posts:
- How to get the function name inside a function in PHP ?
- 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
- 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
- PHP | is_numeric() Function
- PHP | Imagick adaptiveSharpenImage() 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.


