How can the issue of form input being treated as strings be addressed when trying to validate numerical input in PHP?

When validating numerical input in PHP, the issue of form input being treated as strings can be addressed by using the `filter_var()` function with the `FILTER_VALIDATE_INT` filter. This function will validate that the input is an integer and return it as an integer data type, regardless of how it was entered in the form.

// Retrieve input from form
$input = $_POST['number'];

// Validate input as an integer
$number = filter_var($input, FILTER_VALIDATE_INT);

if ($number === false) {
    echo "Invalid input. Please enter a valid number.";
} else {
    echo "Valid input: " . $number;
}