How I can use variable variables with array to get result like is below?

I've tried so far:

```
// $g_module_id_bar_1['id'] = 5;

$i = 1;

$variablename = 'g_module_id_bar_'.$i;
$key = '\'id\'';

echo $$variablename[$key];

```

Result should be: **5**