How to correctly validate a code that must be integer through $ _GET?

0

I want to know how to validate a code that must be integer through $ _GET?

For example, I have a GET called id and it theoretically always must be integer (1,2,3,4,5 ...). Is the way I'm validating correct?

$id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ? $_GET['id'] : 0;
    
asked by anonymous 05.10.2017 / 20:54

0 answers