Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP equivalent of Java's Character.getNumericValue(char c)?

Tags:

java

php

unicode

Is there a PHP equivalent of Java's Character.getNumericValue(char c)?

like image 754
zacharydanger Avatar asked Nov 06 '22 08:11

zacharydanger


1 Answers

Use the intval() function.

This will not handle letters or roman numerals the same way, but you could create your own method to do that for those cases. It will handle standard digits, though.

if (intval("2") === 2)
  echo("YAY!");
like image 130
Erick Robertson Avatar answered Nov 09 '22 04:11

Erick Robertson