title: PHP 7.2 count() function is not working
body: <p>I have a working php application and it is running fine on php 7.0 version. But when I upgrade a php version to 7.2. I am getting this error:</p>
  
  <pre><code>count(): Parameter must be an array or an object that implements Countable
  </code></pre>
  
  <p>I am getting errors on code where I am comparing my data with count function. For example this is my code:</p>
  
  <pre><code>$keytest = KeyUser::where('key', '=', $key)-&gt;first();
   if (count($keytest) == 1) {
     //logic ... 
    }
  </code></pre>
  
  <p>I am using laravel where I am running a query and counting it if it is equal to 1 then logic should work. </p>
  
  <p>So my problem is I have written this kind of logic on many controllers and if I have to change everything one by one it could become nightmare.  So is there any way where I can write a global function to make count work as it was working in php older version. What can be the easiest fix. </p>