title: PHP $$var['index'] = something; fails, although I thought it would work just like $$var = something; does
body: <p>I was trying to use the $$ syntax in PHP for accessing arrays where we can put name of a variable inside another variable and access that variable.</p>
  
  <p>I have used this syntax many times before in different ways, but to my surprise this didn't work for me and lost lot of time over it.</p>
  
  <p>Here is sample code to replicate my problem:</p>
  
  <pre><code>$test=array(
  'a'=&gt;array(array(1,2,3),array(4,5,6),array(7,8,9))
  );
  
  $var = 'test';
  var_dump($$var);
  var_dump($$var['a']);
  </code></pre>
  
  <p>The line <code>var_dump($$var)</code> works as expected, but I'm getting a Warning: Illegal string offset 'a' at line <code>var_dump($$var['a']);</code> and the var_dump prints just <code>null</code></p>
  
  <p>Why doesn't this work? What am I doing wrong here?
  Is there any work around if the syntax is not supported for arrays?</p>