title: PHP 7.2 - Warning: count(): Parameter must be an array or an object that implements Countable
body: <p>I just upgraded my PHP installation from version <strong>5.6</strong> to <strong>7.2</strong>. I used the <code>count()</code> function on my login page like so:</p>
  <pre class="lang-php prettyprint-override"><code>if (!empty($_POST['username']) &amp;&amp; !empty($_POST['password'])):
      $records = $conn-&gt;prepare('SELECT id,username,password FROM users WHERE username = :username');
      $records-&gt;bindParam(':username', $_POST['username']);
      $records-&gt;execute();
      $results = $records-&gt;fetch(PDO::FETCH_ASSOC);
  
      $message = '';
      
      if (count($results) &gt; 0 &amp;&amp; password_verify($_POST['password'], $results['password'])) {
          $_SESSION['user_id'] = $results['id'];
          header(&quot;Location: /&quot;);
      } else {
          $message = 'Sorry, those credentials do not match';
      }
  endif;
  </code></pre>
  <p>After searching, I found questions and answers similar to this one, but they all were related to WordPress, and I couldn’t find a solution for <strong>Pure PHP</strong>.</p>