I need to create a array with a dynamic key.
Example:
{% set key = 'a' %}
{% set value = 'b' %}
{% set array = {key:value} %}
I find a workaround for this problem: if you surround the key
with parenthesis the key of array take the value of the variable instead of the name. So try simple this:
{% set array = { (key): value} %}
Here a working solutions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With