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



is_countable › WordPress Function

Since4.9.6
已弃用n/a
is_countable ( $value )
参数:
  • (mixed) $value The value to check.
    Required: Yes
返回:
  • (bool) True if `$value` 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( $value ) {
		return ( is_array( $value )
			|| $value instanceof Countable
			|| $value instanceof SimpleXMLElement
			|| $value instanceof ResourceBundle
		);
	}
}