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 228 views
228 views asked Aug 17, 2019 by avibootz
3 answers 417 views
2 answers 284 views
2 answers 274 views
2 answers 287 views
3 answers 373 views
3 answers 375 views
...