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.