Determine if a variable is an integer or float.
Source Code
$num = 10.5;
if (is_int($num)) {
echo "$num is an integer";
} elseif (is_float($num)) {
echo "$num is a float";
} else {
echo "$num is not an integer or float";
}
Determine if a variable is an integer or float.
$num = 10.5;
if (is_int($num)) {
echo "$num is an integer";
} elseif (is_float($num)) {
echo "$num is a float";
} else {
echo "$num is not an integer or float";
}