A WordPress-centric search engine for devs and theme authors



is_iterable ›

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

Polyfill for is_iterable() function added in PHP 7.1.

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



Source

function is_iterable( $var ) {
		return ( is_array( $var ) || $var instanceof Traversable );
	}
}