blob: 0233eca48f5878e4c3155f8a7e05fb26e33d55d1 [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001``empty``
2=========
3
4``empty`` checks if a variable is an empty string, an empty array, an empty
5hash, exactly ``false``, or exactly ``null``.
6
7For objects that implement the ``Countable`` interface, ``empty`` will check the
8return value of the ``count()`` method.
9
10For objects that implement the ``__toString()`` magic method (and not ``Countable``),
11it will check if an empty string is returned.
12
13.. code-block:: twig
14
15 {% if foo is empty %}
16 ...
17 {% endif %}
18