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 = \
You can't with only empty(). See the manual. You can do this though:
if ($var !== '0' && empty($var)) { echo "$var is empty and is not string '0'"; }
Basically, empty() does the same as:
if (!$var) ...
But doesn't trigger a PHP Notice when the variable is not set.