IntlChar::charDigitValue() function in PHP


The IntlChar::charDigitValue() function checks if the entered value is a decimal digit value or not.

Syntax

int IntlChar::charDigitValue(val)

Parameters

  • val − A character or integer value encoded as a UTF-8 string.

Return

The IntlChar::charDigitValue() function returns TRUE if the entered value is a decimal digit.

Example

The following is an example −

<?php
   var_dump(IntlChar::charDigitValue("989"));
   echo "<br>";
   var_dump(IntlChar::charDigitValue("1"));
   echo "<br>";
   var_dump(IntlChar::charDigitValue("Humpty"));
   echo "<br>";
   var_dump(IntlChar::charDigitValue("u{0774}"));
?>

Output

The following is the output −

NULL
int(1)
NULL
NULL

Updated on: 30-Dec-2019

24 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements