Skip to main content

Checks if a string contains both alpha and numeric characters.

/**
 * Validate alpha-numeric
 *
 * @param  string
 * @return  bool
 */  
function alpha_numeric($str) {
  return ( ! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE;
}