title: Variable variables as array in php
body: <p>I've successfully followed what I believe to be the correct steps outlined in the php documentation to create a variables from other variables: <a href="http://php.net/manual/en/language.variables.variable.php" rel="nofollow">http://php.net/manual/en/language.variables.variable.php</a>, but get unstuck when a variable is an array.</p>
  
  <p>I include many arrays at the start of my php file such as:</p>
  
  <pre><code>$maths5 = array(
  array(
      'csv'=&gt;'file.csv',
      'title'=&gt;"Number and Place Value",
      )
  );
  </code></pre>
  
  <p>Then dynamically refer to them with user variables like this</p>
  
  <pre><code>$var = $_GET['subject'] . $_GET['year'];
  </code></pre>
  
  <p>From what I've read, I don't understand why </p>
  
  <pre><code>echo $$var;
  </code></pre>
  
  <p>this returns "Array" as expected, but</p>
  
  <pre><code>echo $$var[0];
  </code></pre>
  
  <p>returns "maths5[0]", not "Array", and</p>
  
  <pre><code>echo $$var[0]['csv'];
  </code></pre>
  
  <p>returns "Fatal error: Cannot use string offset as an array". I aiming to return "file.csv". I don't know how to interpret this error message. </p>
  
  <p>Any help would be really appreciated.</p>