IntlChar::isalnum() function in PHP

ProgrammingServer Side ProgrammingPHP

The IntlChar::isalnum() function is used to check the given input is an alphanumeric character or not. The alphanumeric character is a digit or letter.

Syntax

bool IntlChar::isalnum(val)

Parameters

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

Return

The IntlChar::isalnum()function returns TRUE if the val is alphanumeric.

Example

The following is an example −

<?php
   var_dump(IntlChar::isalnum("$$"));
   echo "<br>";
   var_dump(IntlChar::isalnum("Jack Sparrow!"));
   echo "<br>";
   var_dump(IntlChar::isalnum("99"));
   echo "<br>";
   var_dump(IntlChar::isalnum("J"));
   echo "<br>";
?>

Output

The following is the output −

NULL
NULL
NULL
bool(true)

Example

Let us see another example −

<?php
   var_dump(IntlChar::isalnum("#"));
   echo "<br>";
   var_dump(IntlChar::isalnum("1"));
?>

Output

The following is the output −

bool(false)
bool(true)
raja
Published on 21-Feb-2019 13:40:22
Advertisements