I am confused here if I write and don’t write empty() function, the output I receive is always same, so why we would use empty with OR operator?
if ($cat_title === "" || empty($cat_title))
{
echo "Hey, don't skip this again";
}
I am confused here if I write and don’t write empty() function, the output I receive is always same, so why we would use empty with OR operator?
if ($cat_title === "" || empty($cat_title))
{
echo "Hey, don't skip this again";
}
as far as you know … j/k
Welcome to the world of “truthy” comparison. A not so easy thing to grasp, especially since different languages can have somewhat different “rules”.
And a good reason why using strict comparison is almost always better than loose comparison.
Brace yourself, and take a look at
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.