2

I'm using twig and want to check if the given variable xyz has more than x entries. How is that possible?

Thanks!

2 Answers 2

4

Yes, the length filter is the way to go.

{% if xyz | length > x %}
   {% do something %}
{% endif %}
Sign up to request clarification or add additional context in comments.

Comments

0

Okay, I think xyz|length will work.

1 Comment

You "answered" your own question in a speculative manner without a working example?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.