php check if input is int
// Check if variable is int
$id = "1";
if(!intval($id)){
throw new Exception("Not Int", 404);
}
else{
// this variable is int
}
0
0
$a = 5; //returns true
$a = "5"; //returns false
$a = 5.3; //returns false
is_int($a);
Thank you!
0
0
Are there any code examples left?
New code examples in category PHP