For a Non Countable Objects
$count = count($data);
print "Count: $count\n";
Warning: count(): Parameter must be an array or an object that implements Countable in example.php on line 159
#Quick fix is to just cast the non-countable object as an array..
$count = count((array) $data);
print "Count: $count\n";
Count: 250