WordPress开发者和主题制作者的搜索引擎



is_countable ›

Since4.9.6
已弃用n/a
is_countable ( $var )
参数:
  • (mixed) $var The value to check.
    Required: Yes
返回:
  • (bool) True if `$var` is countable, false otherwise.
定义在:
文档:

Polyfill for is_countable() function added in PHP 7.3.

Verify that the content of a variable is an array or an object implementing the Countable interface.



源码

function is_countable( $var ) {
		return ( is_array( $var )
			|| $var instanceof Countable
			|| $var instanceof SimpleXMLElement
			|| $var instanceof ResourceBundle
		);
	}
}