show how to use a variable as hash map key

This commit is contained in:
Tobias Olry
2017-07-29 20:25:20 +02:00
committed by Fabien Potencier
parent 6e17134b1a
commit ef6c950505
+2 -1
View File
@@ -611,7 +611,8 @@ exist:
{ 2: 'foo', 4: 'bar' }
{# keys as expressions (the expression must be enclosed into parentheses) -- as of Twig 1.5 #}
{ (1 + 1): 'foo', (a ~ 'b'): 'bar' }
{% set foo = 'foo' %}
{ (foo): 'foo', (1 + 1): 'bar', (foo ~ 'b'): 'baz' }
* ``true`` / ``false``: ``true`` represents the true value, ``false``
represents the false value.