How to determines whether a character is a letter in PHP

1 Answer

0 votes
$n = '9';
if (ctype_alpha($n))
    echo "yes<br />";
else
    echo "no<br />";

$n = 'a';
if (ctype_alpha($n))
    echo "yes<br />";
else
    echo "no<br />";
    
 
/*
run:
  
no
yes
  
*/

 



answered Dec 5, 2016 by avibootz

Related questions

...