We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Volt adding and (&) in if or elseif

I am writing to check if we can validate mulitiple values using & operator in volt if or elseif conditions, I have looked through the documentation couldn't find any such. Please help me with the same.

Like we do in PHP if {xyz==1 && abc==2} then do some logic. or like if {xyz==1 || abc==2}. Hope I made my question clear.



42.1k
Accepted
answer

Hello!

Maybe you try this:

{%if xyz == 1 and abc == 2 %} .... {% endif %}

For more information see https://docs.phalcon.io/en/latest/reference/volt.html#logic

Thanks so much. Appreciate your help.