The IntlChar::getNumericValue() function is an inbuilt function in PHP which is used to get the numeric value for a Unicode code point as defined in the Unicode Character Database.
Syntax:
float IntlChar::getNumericValue( $codepoint )
Parameters: This function accepts a single parameter $codepoint which is mandatory. The input parameter is a character, which is encoded as a UTF-8 string.
Return Value: This function returns the numeric value of codepoint on success, or IntlChar::NO_NUMERIC_VALUE if none is defined.
Below programs illustrate the IntlChar::getNumericValue() function in PHP:
Example 1:
<?php // PHP program to illustrate the use of // IntlChar::getNumericValue() Function       // Input int codepoint value var_dump(IntlChar::getNumericValue( "2" ));       // Input int codepoint value var_dump(IntlChar::getNumericValue( "4" ));       // Input char codepoint value var_dump(IntlChar::getNumericValue( "G" ));       // Input string codepoint value var_dump(IntlChar::getNumericValue( "Geeks" ));   // Input Symbolic codepoint value var_dump(IntlChar::getNumericValue( "$" ));   // Input Symbolic codepoint value var_dump(IntlChar::getNumericValue( "\u{216C}" ));   // Input Symbolic codepoint value var_dump(IntlChar::getNumericValue( "\u{216F}" ));   ?> |
float(2) float(4) float(-123456789) NULL float(-123456789) float(50) float(1000)
Example 2:
<?php // PHP program to illustrate the use of // IntlChar::getNumericValue() Function   // Declare an array with // different codepoint value $arr = array ( "4" ,             "1" ,             "Geeks" ,             "\u{216C}" ,             "\u{216F}" ,             65,         );       // For loop condition to check // each character through function foreach ( $arr as $val ) {               // Check each element as code point data     var_dump(IntlChar::getNumericValue( $val )); } ?> |
float(4) float(1) NULL float(50) float(1000) float(-123456789)
Reference: http://php.net/manual/en/intlchar.getnumericvalue.php