title: PHP: Comparison operators vs booleans when using mysqli_num_rows() function to conditionally check for zero or non-zero result?
body: <p>Probably a stupid question but it's 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?</p>
  <p>People typically do this:</p>
  <pre><code>if(mysqli_num_rows($res) &gt; 0) {...} 
  </code></pre>
  <p>...or...</p>
  <pre><code>if(mysqli_num_rows($res) &lt; 1) {...}
  </code></pre>
  <p>...but hardly anybody does this:</p>
  <pre><code>if(mysqli_num_rows($res)) {...}
  </code></pre>
  <p>...or...</p>
  <pre><code>if(!mysqli_num_rows($res)) {...}
  </code></pre>
  <p>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?</p>