Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website] / vendor / twig / twig / doc / tests / empty.rst
1 ``empty``
2 =========
3
4 .. versionadded:: 1.33
5
6     Support for the ``__toString()`` magic method has been added in Twig 1.33.
7
8 ``empty`` checks if a variable is an empty string, an empty array, an empty
9 hash, exactly ``false``, or exactly ``null``.
10
11 For objects that implement the ``Countable`` interface, ``empty`` will check the
12 return value of the ``count()`` method.
13
14 For objects that implement the ``__toString()`` magic method (and not ``Countable``),
15 it will check if an empty string is returned.
16
17 .. code-block:: jinja
18
19     {% if foo is empty %}
20         ...
21     {% endif %}
22