You should use the empty() construct when you are not sure if this variable exists. If you expect the variable to be set, use if ($var) instead.
empty() is the equivalent !isset($var) || $var == false !isset($var) || $var == false . It returns true if the variable:
"" (empty string)0 (0 as an integer)0.0 (0 as a float)"0" (0 as a string)NULLFALSEarray() (empty array)var $var; (declared variable, but no value in the class)
source share