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 227 views
227 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
...