News for hackers. Stuff that matters.
Re:PHP 7 deployment at Dailymotion by mastre_ on Monday October 17, 2016 @09:32PM (#12731327)
This is not so much a PHP thing as it is a different way of thinking about things. If you know something is supposed to be an integer, you can simply force it to an integer before you do anything with it:

  $id = intval(@$_POST['id']);
  if (!empty($id)) { ... }
Note: 0 shouldn't be a valid value for something called 'id', since it's likely a db id; if it is, use something other than an empty() check.

There are no comments on this comment yet.