function twig_test_iterable in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/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/ Extension/ Core.php - Returns a list of tests to add to the existing list.
File
- vendor/
Twig/ Extension/ Core.php, line 1396
Code
function twig_test_iterable($value) {
return $value instanceof Traversable || is_array($value);
}