<?php
var_dump(
count(null), // NULL 不可数
count(1), // 整数不可数
count('abc'), // 字符串不可数
count(new stdClass), // 没有实现 Countable 接口的对象不可数
count([1,2]) // 数组可数
);
Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
int(1)
int(1)
int(1)
int(2)