0

im getting this warning on my website "Warning: count(): Parameter must be an array or an object that implements Countable in /home4/geec/public_html/home/wp-content/plugins/industing-assistance/inc/elementor/style/services/style1.php on line 92

here is my line 92

echo substr($content, 0, ($spos = strpos($content, ' ', $lcount = count($content) > 65 ? $lcount : 65)) ? $spos : $lcount );

What exactly do I need to add or change on my php file? Thanks

  • That single line of code, apart from not being complete, does not even contain a call to `count()`. You need to give us some _proper_ information here at least. – CBroe Jul 09 '21 at 08:27
  • What do you want to do if $content is false or null, like it seems? – Fran Cerezo Jul 09 '21 at 08:38
  • then, what should i put in content? – Maria Rivas Jul 09 '21 at 08:43
  • here is the complete line echo substr($content, 0, ($spos = strpos($content, ' ', $lcount = count($content) > 65 ? $lcount : 65)) ? $spos : $lcount ); – Maria Rivas Jul 09 '21 at 08:43
  • might be off topic so i am writing it as comment it might be due to PHP version too. I had similar issue when I needed lower version of php – Anuj Shrestha Jul 09 '21 at 09:03
  • 1
    `count($content)` it seems `$content` is not an array or object, If it an object of a class, that class should implement `Countable` interface – Haridarshan Jul 09 '21 at 09:09
  • would you help me on telling me what exact code I need to put in order to fix it? when you say implement countable interface – Maria Rivas Jul 09 '21 at 09:32
  • It hard to tell how to implement until you don't share what is `$content`. Share output of this `var_dump($content);` – Haridarshan Jul 09 '21 at 11:56

0 Answers0