title: Exploding string into array, but assigning first value of the string as key in new array
body: <p>I'm trying to create an array, looping through another array and taking the string value within the key to assigning it as a key/value pair in the new array. Here's a sample of the array of values I'm using outputted via var_dump:</p>
  
  <pre><code>array 
    0 =&gt; string 'dog,bark' (length=8)
    1 =&gt; string 'cat,meow' (length=8)
    2 =&gt; string 'cow,moo' (length=7)
  </code></pre>
  
  <p>What I want to do have it so in the new array, it is set up as such</p>
  
  <pre><code>array 
    'dog' =&gt; string 'bark' (length=4)
    'cat' =&gt; string 'meow' (length=4)
    'cow' =&gt; string 'moo' (length=3)
  </code></pre>
  
  <p>I thought that explode would do the trick, delimiting by commas, but it doesn't populate the keys as intended, instead using the standard numerical values. So after doing some research and coming up blank, i'm wonder if there's a php function that i'm missing, or have missed some simple amount of logic that would do what i'm after.</p>
  
  <p>EDIT: Forgot the most important part. Here's the current code that is assigning values to the new array. One reason not to code at 2am</p>
  
  <pre><code>foreach ($array as $key=&gt;$value) {
       $newArray= explode(',', $array [$key]);
  }
  </code></pre>