title: create associative array from simple array, auto increment key for each array item
body: <p>I have a simple array in the format <code>$arr = array(a,b,c,d);</code> that is dynamically populated.</p>
  
  <p>How would I convert this into an associative array like </p>
  
  <pre><code>$newarr = array(
      'embedCode0' =&gt; a,
      'embedCode1' =&gt; b,
      'embedCode2' =&gt; c,
      'embedCode3' =&gt; d
      );
  </code></pre>
  
  <p>I know I can already access <code>b</code> in <code>$arr</code> with <code>$arr[1]</code> but I am passing <code>$newarr</code> from PHP to Javascript and accessing the array items in JS using <code>phpVars.embedCode0</code>, <code>phpVars.embedCode1</code> etc</p>
  
  <p>I have tried to access the items from <code>$arr</code> in JS using <code>phpVars[0]</code> and <code>phpVars.[0]</code> but neither method works so I think I need to create the associative array with the key values in PHP first.</p>