Validating Integer Values in PHP


Validate and filter integer values using filter_var().

Source Code

$number = "5";
if (filter_var($number, FILTER_VALIDATE_INT) !== false) {
    echo "This is a valid integer!";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments