Recently I faced one issue where I noticed that zero is being equal to empty string and my condition was being true.
$a = 0; if($a == ''){ echo 'Condition true'; }else{ echo 'Condition false'; }
Recently I faced one issue where I noticed that zero is being equal to empty string and my condition was being true.
$a = 0; if($a == ''){ echo 'Condition true'; }else{ echo 'Condition false'; }
Make a habit to use === comparison operator instead of double equality. This not the only case where double equality operators fails there are dozens of cases.