wpseek.com
A WordPress-centric search engine for devs and theme authors



is_countable › WordPress Function

Since4.9.6
Deprecatedn/a
is_countable ( $value )
Parameters:
  • (mixed) $value The value to check.
    Required: Yes
Returns:
  • (bool) True if `$value` is countable, false otherwise.
Defined at:
Codex:

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.


Source

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