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 235 views
235 views asked Aug 17, 2019 by avibootz
3 answers 420 views
2 answers 286 views
2 answers 274 views
2 answers 292 views
3 answers 376 views
3 answers 378 views
...