IntlChar::isalnum() function in PHP


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)

Updated on: 30-Dec-2019

103 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements