How to check if a string is alphanumeric in PHP

1 Answer

0 votes
$s = "php73";

if (ctype_alnum($s)) {
    echo "true<br />";
}
else {
    echo "false<br />"; 
}
      
 
  
    
/*
run:
         
true
  
*/

 



answered Aug 17, 2019 by avibootz
...