0

I hava a Twig question. I have an array:

{% set frequency = [ 5,5,5,5,5,5,5,5,5,5,5 ] %}

And shot.punctation is displaying: 5 6 9 3 5 6 4 2 6 5 6 3 2 4 2 8 3 2 1 4 7 5 5 6 10 9 2 7 8 6 2 3 4 1 3 8 9 7 3 4. And I want do something like that:

{% for shot in shots %}
    {% set frequency[shot.punctation] = frequency[shot.punctation] + 1 %}
{% endfor %}

but I don't know how.

I need to count every variable of my array.

wp78de
  • 18,207
  • 7
  • 43
  • 71

0 Answers0