1``empty`` 2========= 3 4.. versionadded:: 2.3 5 6 Support for the ``__toString()`` magic method has been added in Twig 2.3. 7 8``empty`` checks if a variable is an empty string, an empty array, an empty 9hash, exactly ``false``, or exactly ``null``. 10 11For objects that implement the ``Countable`` interface, ``empty`` will check the 12return value of the ``count()`` method. 13 14For objects that implement the ``__toString()`` magic method (and not ``Countable``), 15it will check if an empty string is returned. 16 17.. code-block:: twig 18 19 {% if foo is empty %} 20 ... 21 {% endif %} 22 23