mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-18 13:26:37 +00:00
22 lines
282 B
Plaintext
22 lines
282 B
Plaintext
--TEST--
|
|
Accessing arrays with stringable objects as key
|
|
--TEMPLATE--
|
|
{% set hash = {
|
|
'foo': 'FOO',
|
|
'bar': 'BAR',
|
|
} %}
|
|
|
|
{{ hash[key] }}
|
|
--DATA--
|
|
class MyObj {
|
|
public function __toString() {
|
|
return 'foo';
|
|
}
|
|
}
|
|
|
|
return [
|
|
'key' => new MyObj(),
|
|
];
|
|
--EXPECT--
|
|
FOO
|