title: Fatal error: Cannot unset string offsets error?
body: <p>Not sure why this is occurring: Basically, I have an array that contains the following arrays, see <code>var_dump</code>:</p>
  
  <pre><code>array(2) { 
    [0]=&gt; array(1) { 
      [0]=&gt; string(3) "ivr" 
    } 
    [1]=&gt; array(1) { 
      [0]=&gt; string(9) "ivr_dests" 
    } 
  }
  </code></pre>
  
  <p>Obviously this data is kind of redundant, but it's what was returned while getting values with xpath. So I'm doing a <code>foreach</code> to loop through the first <code>array()</code> and assign it's nested array values in the first array. </p>
  
  <p>Basically, it should return this:</p>
  
  <pre><code>array(2) {
    [0]=&gt; string(3) "ivr"
    [1]=&gt; string(9) "ivr_dests"
  }
  </code></pre>
  
  <p>So here is what I've setup:</p>
  
  <pre><code>foreach($arr as $key =&gt; $arr2){
      $arr2[$key] = $arr2[$key][0];
      unset($arr2[$key][0]); //This returns Fatal error: Cannot unset string offsets
  //if I comment out the unset(), $arr[$key] returns the same value as it did (multidim array)
  };
  
          //I tried this too:
  $i=0;
  foreach($arr as $arr2){
    $arr2[$i] = $arr2[$i][0];
    $i++;
  }
  </code></pre>
  
  <p>Any ideas what I'm doing wrong? Should I go about this another way?</p>
  
  <p>Thanks,   </p>