How to check if a variable is equal to zero in twig and value defined How to check if a variable is equal to zero in twig and value defined php php

How to check if a variable is equal to zero in twig and value defined


The way of checking for not null is:

{% if var is not null %}

But you can use the same as function:

{% if var is same as(0) %}    {# do something %}{% endif %}

Ref: http://twig.sensiolabs.org/doc/tests/sameas.html


Try this

{% if filterStatus == 0 and filterStatus is (not) empty %}