How to get a particular index of array in tpl files

Hi I want to get the particular index of the array by providing another variable as of the key.

My code is like this


[{foreach from=$language item=lang}]
  <div id="stores">
   [{if !array_key_exists($lang->id,$language_array)}]
     <img src="[{$join_image}]" /> <input type="radio" name="sys_lang" id="sys_lang" />[{$lang->name}]
   [{else}]
    <img src="[{$join_image}]" /> [{$lang->name}] [{$language_array[$lang->id]}]
[{/if}]
 </div>
[{/foreach}]


But it creates the error

Fatal error: Smarty error: [in froomerce_fconnect.tpl line 74]: syntax error: unrecognized tag: $language_array[$lang->id] (Smarty_Compiler.class.php, line 446) in D:\wamp\www\oxid_froomerce\core\smarty\Smarty.class.php on line 1093

I know the error is because of the statement

[{$language_array[$lang->id]}]

having variable as key of the array
Can any body tell how to handle this situation?