How to check if string is alphabetic in PHP

2 Answers

0 votes
$s = "php java";

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

 



answered Aug 17, 2019 by avibootz
0 votes
$s = "phpjava";

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

 



answered Aug 17, 2019 by avibootz
...