Skip to content
Advertisement

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

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

$tags=locchuoi($request,"<span class='SeoH1'>",'</span>');
for($ll=1;$ll<count($tags)+1;$ll++)
{
    $tag_link =   $tag_link.$tags[$ll].",";
}

Advertisement

Answer

$tags=locchuoi($request,"<span class='SeoH1'>",'</span>');
for($ll=1;$ll<(!empty($tags) ? count($tags)+1 : 0);$ll++)
{
   $tag_link =   $tag_link.$tags[$ll].",";
}

Try this code, I just add some condition inside the for() , when the $tags varible is empty return 0 , if not return count($tags)+1 .

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement