What is the difference between is_int and is_numeric in PHP?

The main difference between is_int and is_numeric in PHP is that is_int specifically checks if a variable is an integer, while is_numeric checks if a variable is a numeric value (including integers, floats, and numbers in string format). Therefore, is_int will return true only for variables that are integers, while is_numeric will return true for a wider range of numeric values.

// Using is_int
$number = 10;
if (is_int($number)) {
    echo "The variable is an integer.";
} else {
    echo "The variable is not an integer.";
}

// Using is_numeric
$number = "10.5";
if (is_numeric($number)) {
    echo "The variable is a numeric value.";
} else {
    echo "The variable is not a numeric value.";
}