How to check if string is numeric in PHP

1 Answer

0 votes
$s = "3983201"; 

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

 



answered Aug 17, 2019 by avibootz

Related questions

1 answer 224 views
224 views asked Aug 17, 2019 by avibootz
3 answers 412 views
2 answers 281 views
2 answers 270 views
2 answers 285 views
3 answers 369 views
3 answers 372 views
...