Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi Larry


Whilst debugging an error in script 9.9 - page.php I inadvertantly discovered that array('min_range' =>1) doesn't seem to do anything in this line:


!filter_var($_GET['id'], FILTER_VALIDATE_INT, array('min_range' => 1)))


After fixing my problem I played around with this, changing it to == 2, < 0, => 5 etc. and omitting it altogether, yet the script still worked.


Have I missed something?




Link to comment
Share on other sites

  • 1 year later...

(Finally clearing up threads that I've been "watching" for wwwwwaaaaaaayyyyy too long, but for posterity...) This may have been a change in PHP since the book was written as the PHP manual now says you should pass options as an options array:


In other words, the code should be:

!filter_var($_GET['id'], FILTER_VALIDATE_INT, array('options' => array('min_range' => 1))))
Link to comment
Share on other sites


  • Create New...