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 154 views
154 views asked Aug 17, 2019 by avibootz
3 answers 304 views
2 answers 168 views
2 answers 152 views
2 answers 170 views
3 answers 221 views
3 answers 203 views
...