IntlChar::ord() function in PHP


The IntlChar::ord()function is used to return the Unicode code point value of the entered character.

Syntax

int IntlChar::ord( char_unicode )

Parameters

  • char_unicode − A Unicode Character

Return

The IntlChar::ord()function returns theUnicode value as an integer.

Example

The following is an example −

<?php
   var_dump(IntlChar::ord("H"));
   echo "<br>";
   var_dump(IntlChar::ord("9"));
?>

Output

The following is the output −

int(72)
int(57)

Example

Let us see another example −

<?php
   var_dump(IntlChar::ord("%"));
   echo "<br>";
   var_dump(IntlChar::ord("Fine!"));
?>

Output

The following is the output −

int(37)
NULL

Updated on: 30-Dec-2019

34 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements