PHP Classes

File: Library/vendor/twig/twig/doc/tests/iterable.rst

Recommend this page to a friend!
  Classes of Duong Huynh Nghia   Lego PHP   Library/vendor/twig/twig/doc/tests/iterable.rst   Download  
File: Library/vendor/twig/twig/doc/tests/iterable.rst
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Lego PHP
Blog and shopping cart system
Author: By
Last change:
Date: 7 years ago
Size: 463 bytes
 

Contents

Class file image Download
``iterable`` ============ .. versionadded:: 1.7 The iterable test was added in Twig 1.7. ``iterable`` checks if a variable is an array or a traversable object: .. code-block:: jinja {# 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 %}