Forums / Developer / Dynamic lookup in array

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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...