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

Count(): Parameter must be an array or an object that implements Countable – What’s wrong? When you work on your files on localhost in an XAMPP environment, have you ever faced the error Count(): Parameter must be an array or…

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

Count(): Parameter must be an array or an object that implements Countable – What’s wrong?

When you work on your files on localhost in an XAMPP environment, have you ever faced the error Count(): Parameter must be an array or an object that implements Countable? This error appears because there is an issue with the parameter which is passed to the count function.

Don’t worry, because in today’s blog, we would like to bring you some suggested solutions that you can try to solve this trouble. So, let’s dig in now!

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

How to fix the error Count(): Parameter must be an array or an object that implements Countable

As you know, since PHP 7.2, there is a warning on invalid countable types that are passed to the array_or_countable parameter. Therefore, in order to deal with this issue, you need to follow one of the three methods below:

  • Go to your localhost with XAMPP -> go to the line where the error occurs -> replace the code:

$fcount = count($rawnames);

into:

$fcount = (is_array($rawnames)) ? count($rawnames) : 0;

  • Use a previous version of PHP instead of PHP 7.2.
  • Get in touch with the plugin support and ask them for help with the error.

Wrap up

All in all, those are 3 solutions you should try to address the error Count(): Parameter must be an array or an object that implements Countable. We hope that the methods above will work successfully to help you remove the error. Any other solution to this trouble? If yes, don’t forget to share it with us by leaving your comment below. We would appreciate it.

Last but not least, we are providing many high-quality and fully responsive Joomla 4 Templates and Free WordPress Themes, so don’t hesitate to visit our site and get the best one whenever you want. Thanks for reading and have a great day.

Build it with a template

Start from a finished design: Joomla templates, WordPress themes or the AI-ready block themes. Every template has a free version and a live demo.

Stuck on a template?

Pro customers can open a ticket; everyone can read the documentation.

Free download

We'll send the link, setup tips and update notices, and you can reach us anytime through our AI assistant and contact form.

The download starts at once. We email you the link and ask you to confirm your address. Privacy policy.