I want a 0 to be considered as an integer and a \'0\' to be considered as a string but empty() considers the \'0\' as a string in the example below,
$var = \
I always add to my codebase
function is_blank($value) { return empty($value) && !is_numeric($value); }
and use it instead of empty(). It solves the issue of keeping zeros (int, float or string) as non-empty.
See http://www.php.net/manual/en/function.empty.php#103756 which was added May 2011.