In JS I used this code:
if(string.match(/[^A-Za-z0-9]+/))
but I don\'t know, how to do it in PHP.
PHP can compare a string to a regular expression using preg_match(regex, string) like this:
preg_match(regex, string)
if (!preg_match('/[^A-Za-z0-9]+/', $string)) { // $string contains only English letters and digits }