Twig Components / Methods / reverse
reverse(preserveKeys = false)
is a Twig filter to reverse a sequence, a mapping, or a string:
Tip: For sequences and mappings, numeric keys are not preserved. To reverse them as well, pass true as an argument to the reverse filter:
Note: It also works with objects implementing the Traversable interface.
Arguments¶
- preserve_keys: Preserve keys when reversing a mapping or a sequence.
Source: Twig
Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.