count(): Parameter must be an array

Posted in CategoryGeneral Discussion
  • Shaun Collins 8 months ago
    Thanks Terry, that looks much better than what I had and works perfectly!
  • Terry Ogbemudia 8 months ago

    Hi Collins instead of that just do a check to see if that variable or array is set

    @if(isset($products) && count($products)) 
  • Shaun Collins 9 months ago

    Found a solution Terry

    If you put this snippet at the beginning of the routes file =

    if(version_compare(PHP_VERSION, '7.2.0', '>=')) { 

     error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);


    If anyone else runs into this problem it works OK, not sure how this will do in production though!

  • Shaun Collins 9 months ago

    Hi Terry,

    After doing the error message blade and reloading I get: 

    count(): Parameter must be an array or an object that implements Countable ,

    I had a look in StackOverflow and they suggest either downgrading to PHP7.1 or upgrading Laravel.

Please login or register to leave a response.