Here's the PHP code:
if ($var===0) {do something}
It "does something" only when $varit is actually 0 (and if it is $varnot installed, it does not work, so everything is in order).
However, Twig does not support the === operator, and if I write:
{% if var==0 %}do something{% endif %}
he "does something" all the time (even if $varnot installed). To fix this, I wrote this code:
{% if var matches 0 %}do something{% endif %}
Is this the right way to do === comparison in Twig, or am I doing something wrong here? If it is wrong, how should it be fixed?
source
share