function twig_test_empty in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/Twig/Extension/Core.php \twig_test_empty()
Checks if a variable is empty.
<pre> {# evaluates to true if the foo variable is null, false, or the empty string #} {% if foo is empty %} {# ... #} {% endif %} </pre>
Parameters
mixed $value A variable:
Return value
bool true if the value is empty, false otherwise
1 call to twig_test_empty()
- _twig_default_filter in vendor/
twig/ twig/ lib/ Twig/ Extension/ Core.php - @internal
1 string reference to 'twig_test_empty'
- Twig_Extension_Core::getTests in vendor/
twig/ twig/ lib/ Twig/ Extension/ Core.php
File
- vendor/
twig/ twig/ lib/ Twig/ Extension/ Core.php, line 1401
Code
function twig_test_empty($value) {
if ($value instanceof Countable) {
return 0 == count($value);
}
return '' === $value || false === $value || null === $value || array() === $value;
}