-1

How can I resolve this warning in PHP7.2 ?

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

Just check variable before passing to count() ?

hd.
  • 17,596
  • 46
  • 115
  • 165
  • Depends on what you want to achieve. Maybe you can add more details and for example some code so we can understand your context. – Jnt0r Jan 19 '19 at 10:41

1 Answers1

0

Yes, you can check it for example by

if (is_array($variable) && count($variable) > 0) { ... }
danyg
  • 105
  • 1
  • 9