parameter must be an array or an object that implements countable

parameter must be an array or an object that implements countable : PHP Warning: count(): Parameter must be an array or an object that implements Countable

parameter must be an array or an object that implements countable

how to solved parameter must be an array or an object that implements countable in php? “count() parameter must be an array or an object that implements countable laravel”

Also Read This πŸ‘‰   PHP Check If mail() function is enable

add a typecast array to the array being called

$count = count((array)$product_Array);

if (is_array($product_Array)) {
    //Your count()
}

count() parameter must be an array or an object that implements countable in laravel

count(array($variable));

Example

// PHP >= 7.3
if(is_countable($product_Array)) {
    // Your Source code
}

// PHP >= 7.1
if(is_iterable($product_Array)) {
     // Your Source code
}

Don’t Miss : ErrorException In Builder.Php[Solution]

I hope you get an idea about parameter must be an array or an object that implements countable.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.