title: Create variables from a JavaScript array of filenames
body: <p>I have a JavaScript array with the filenames (and their directory location) in it (originally gotten by using PHP to create a PHP array of files in the directory and then converted to a JS array). I'd like to use this array to generate individual variables with the same name as their value.</p>
  
  <p>For example, this is one of the array values, "collada/basement/zones/basementPCroom.dae". I'd like to use this to create a variable called "basementPCroom" which holds the value "collada/basement/zones/basementPCroom.dae". And the same with all other values in the array.</p>
  
  <p>The reason I want to do this is because changing each individually every time I add or remove files would take forever, and I need them to have those specific names so that I can find what I'm looking for easily later.</p>
  
  <p>Thanks for your help!</p>
  
  <p>Below is the code leading up to this:</p>
  
  <pre><code>&lt;?php
  $zones = glob('collada/first/zones/*dae');
  ?&gt;
  var zones = &lt;?php echo json_encode($zones) ?&gt;;
  </code></pre>