What are the best practices for validating integer values in PHP strings?

When validating integer values in PHP strings, it is important to ensure that the input is indeed an integer and not a string representation of an integer. One way to validate integer values in PHP strings is to use the `filter_var()` function with the `FILTER_VALIDATE_INT` filter. This function will return the integer value if the input is a valid integer, or `false` if it is not.

// Validate integer value in a string
$string = "123";
$integerValue = filter_var($string, FILTER_VALIDATE_INT);

if ($integerValue !== false) {
    echo "Valid integer value: " . $integerValue;
} else {
    echo "Invalid integer value";
}