A
A
andrey_levushkin2020-08-14 17:49:23
Twig
andrey_levushkin, 2020-08-14 17:49:23

How to display the last element of a multidimensional array?

There is an array:

A: x=vvv
   y=aaa
B: x=dsaa
   y=asd
C: x=abc
   y=def

(There are 3 elements in the array, each element has string fields x and y)
How to display information about the LAST ELEMENT of this array in the form: xy?
In the example above, you need to get: abc-def

There can be many elements in the array - this is not a specific number

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
andrey_levushkin, 2020-08-14
@andrey_levushkin

Problem solved:
{{ mass|last.x }}-{{ mass|last.y }}
Where mass is the desired array

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question