What are some common pitfalls when trying to check if a user input is an integer in PHP?
When trying to check if a user input is an integer in PHP, a common pitfall is using the `is_int()` function, which only works on variables that are already integers, not user input strings. To properly check if a user input is an integer, you can use the `filter_var()` function with the `FILTER_VALIDATE_INT` filter.
$user_input = $_POST['user_input'];
if (filter_var($user_input, FILTER_VALIDATE_INT) !== false) {
echo "User input is an integer.";
} else {
echo "User input is not an integer.";
}