. Advertisement .
..3..
. Advertisement .
..4..
Hi guys,
This morning I still get the ”warning: count(): parameter must be an array or an object that implements countable in” error when running my code.
The error in this line:
if ( $elements[‘page’] > count( $elements[‘pages’] ) ) {
$elements[‘page’] = count( $elements[‘pages’] );
}
I don’t know what’s wrong? Can someone help me?
The cause: This error is neither a fatal one or an internal server problem that prevents your website from loading, but rather a notice of a bug in the code of a specific file. It can be due to PHP version or upgrade issue.
Solution: Addind this line is_array( $elements[‘pages’] ) && count( $elements[‘pages’] )
And the new code is:
Save the PHP file after replacing the previous line of code with the one from above.