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

how to check if a variable is not empty?

how to check if a variable is not empty in the volt?

this code

{% if resources['mensagem'] is not empty %}
// some code
{% endif %}

doesn't work.

I get this:

Undefined variable: empty

Thanks



98.9k
Accepted
answer

Try:

{% if !(resources['mensagem'] is empty) %}
// some code
{% endif %}
edited Aug '14

Thanks

solved!



13.1k

好东西