We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.



41.9k
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.