What potential pitfalls can arise when using is_int() in a for loop in PHP?

Using is_int() in a for loop in PHP can lead to unexpected results because it checks if a variable is of type integer, not if it is a whole number. To avoid this issue, it's better to use the is_numeric() function to check if a variable is a number, and then use intval() to convert it to an integer if needed.

for ($i = 0; $i < count($array); $i++) {
    if (is_numeric($array[$i])) {
        $intVal = intval($array[$i]);
        // Do something with the integer value
    } else {
        // Handle non-integer values
    }
}