Answers for "if intiger php"

PHP
0

php check if variable is int

// Check if variable is int
$id = "1";

if(!intval($id)){
  throw new Exception("Not Int", 404);
}
else{
	// this variable is int
}
Posted by: Guest on August-02-2021
2

php check if input is int

$a = 5; //returns true
$a = "5"; //returns false
$a = 5.3; //returns false
is_int($a);
Posted by: Guest on May-25-2020

Browse Popular Code Answers by Language