Forums / Developer / Dynamic lookup in array

Dynamic lookup in array

Author Message

Mauro Innocenti

Thursday 04 August 2005 3:45:03 am

I want to lookup an associative array element using a variable as key.
E.g., with this array:

{let my_array=hash(
    'first',hash('a','aa','b','bb'),
    'second',hash('c','cc','d','dd'))}

I want to lookup in this way:

{let my_key='first'}
{$my_array[$my_key]['a']}
{/let}

for getting:

aa

But the above code don't work...