function cek_string_dan_number($string){
  return (preg_match("/[^A-Za-z0-9]/", $string)) ? "false" : "true";
}

echo cek_string_dan_number("abcd123"); //output true
echo cek_string_dan_number("$#$@^%&"); //output false

Comment