Alphanumeric validation

Checks if a string is alphanumeric.

<?php
function isAlphanumeric($str)
{
	if (preg_match("/^([a-z0-9])+$/i", $str)) return true;
	return false; 
}
?>

Usage

Input $str, returns true if the string is alphanumeric, and false if it is not.


Comments

Add your comment