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 236 views
236 views asked Aug 17, 2019 by avibootz
3 answers 420 views
2 answers 287 views
2 answers 275 views
2 answers 293 views
3 answers 379 views
3 answers 380 views
...