What is the difference between the is_int and is_numeric functions in PHP when checking variable types?

The main difference between the is_int and is_numeric functions 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 (integer or float). Therefore, is_int will return true only for integer values, while is_numeric will return true for both integer and float values.

$variable = 10;

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

// Using is_numeric
if (is_numeric($variable)) {
    echo "The variable is numeric.";
} else {
    echo "The variable is not numeric.";
}