IntlChar digit() function in PHP


The IntlChar digit() function is used to display the decimal digit value of a code point for a given radix.

Syntax

int IntlChar::digit( $val, $radix )

Parameters

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

  • radix − The radix value. Default is 10.

Return

The IntlChar digit() function returns the number represented by the character in the given radix.

Example

The following is an example −

<?php
   var_dump(IntlChar::digit("2"));
   echo "<br>";
   var_dump(IntlChar::digit("Z"));
   echo "<br>";
   var_dump(IntlChar::digit("6", 2));
?>

Output

The following is the output −

int(2)
bool(false)
bool(false)

Updated on: 31-Dec-2019

33 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements