Probably a stupid question but it just occurred to me. How safe is actually using booleans instead of comparison operators in a condition to check for ANY returned (or not) rows?
People typically do this:
if(mysqli_num_rows($res) > 0) {...}
...or...
if(mysqli_num_rows($res) < 1) {...}
...but hardly anybody does this:
if(mysqli_num_rows($res)) {...}
...or...
if(!mysqli_num_rows($res)) {...}
I'm not asking if it works or not, I know it does and I know it's legit. But how come this isn't a common practice seeing people tenaciously resort to comparison operators all the way just to see if their query returns more than zero (true) or less than one/zero (false) result? I've tried to envision all possible schemes and failed to detect any pitfalls. All I see is that it's plain convenient, shorter and probably faster, too, although negligibly at that. So, what's the catch? Just a convention?