Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

is_iterable

Description

Verify that the contents of a variable is an iterable value

Syntax

is_iterable(mixed $value): bool

Parameters

value

The value to check

Return

Returns true if value is iterable, false otherwise.

Examples

1

<?

$value = array();

$return = is_iterable($value);

var_export($return);

?>
true

2

<?

$value = array(0, 1);

$return = is_iterable($value);

var_export($return);

?>
true

3

<?

$value = new ArrayIterator();

$return = is_iterable($value);

var_export($return);

?>
true

4

<?

$array = array(0, 1);

$value = new ArrayIterator($array);

$return = is_iterable($value);

var_export($return);

?>
true

5

<?

$value = (function() { yield 1; })();

$return = is_iterable($value);

var_export($return);

?>
true
HomeMenu