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

functtion count in volt

Hi all count($variable)=12(php function) foreach ($variable as $key => $value)

end what is function count equivalent in volt



8.1k

You'll can get this value easy with loop controls : https://docs.phalcon.io/en/latest/reference/volt.html#loop-context Example :

{% set a = [1,2,3] %}
    {% for val in a %}
    {% if loop.first %}
        {{ loop.length }}
    {% endif %}
    {% endfor %}