function twig_test_iterable in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/twig/twig/lib/Twig/Extension/Core.php \twig_test_iterable()
Checks if a variable is traversable.
<pre> {# evaluates to true if the foo variable is an array or a traversable object #} {% if foo is traversable %} {# ... #} {% endif %} </pre>
Parameters
mixed $value A variable:
Return value
bool true if the value is traversable
1 string reference to 'twig_test_iterable'
- Twig_Extension_Core::getTests in vendor/
twig/ twig/ lib/ Twig/ Extension/ Core.php
File
- vendor/
twig/ twig/ lib/ Twig/ Extension/ Core.php, line 1424
Code
function twig_test_iterable($value) {
return $value instanceof Traversable || is_array($value);
}