Spec-Zone.ru › Twig 1

iterable

New in version 1.7: Тест на итерируемость был добавлен в Twig 1.7.

iterable проверяет, является ли переменная массивом или итерируемым объектом:

{# evaluates to true if the foo variable is iterable #}
{% if users is iterable %}
{% for user in users %}
        Hello {{ user }}!
{% endfor %}
{% else %}
{# users is probably a string #}
    Hello {{ users }}!
{% endif %}
« even | null »

© 2009–2018 by the Twig Team
Licensed under the three clause BSD license.
The Twig logo is © 2010–2020 Symfony
https://twig.symfony.com/doc/1.x/tests/iterable.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API