WordPress at a glance

is_iterable() WP 1.0

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.

1 time = 0.000001s = speed of light | 50000 times = 0.01s = speed of light | PHP 7.1.11, WP 4.9.8

No Hooks.


true/false. True if $var is iterable, false otherwise.


is_iterable( $var );
$var(mixed) (required)
The value to check.


Since 4.9.6 Introduced.

Code of is_iterable() WP 5.5.3

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

From tag: PHP analogues (PHP functions replacement)

No comments
    Log In