How to check if character is numeric in PHP

1 Answer

0 votes
$ch = '3'; 

if (ctype_digit($ch)) {
    echo "true";
}
else {
   echo "false"; 
}
      
 
  
    
/*
run:
         
true
  
*/

 



answered Aug 17, 2019 by avibootz

Related questions

1 answer 233 views
233 views asked Aug 17, 2019 by avibootz
3 answers 417 views
2 answers 284 views
2 answers 274 views
2 answers 288 views
3 answers 373 views
3 answers 375 views
...