title: change a key of a single element array
body: <p>I have an array tree from a database,  I want to change the key of a child element in this case the second array 'eric'=>array into integer '0'=>array as follow :</p>
  
  <pre><code>0 =&gt; Array
      ('text' =&gt; 'paris',
       'nodes' =&gt; Array
              ('eric' =&gt; Array
                      (  'text' =&gt; 'eric',
                         'nodes' =&gt; Array
                             (0 =&gt; Array
                                 (
                                  'text' =&gt; 'so.png',              
                                 ),
                             ),
                      ),
              ),
     ),
  </code></pre>
  
  <p>there is my code :</p>
  
  <pre><code>while($d = mysqli_fetch_assoc($result)) {
      if(!isset($data[$d['country']])) {
         $data[$d['country']] = array(
           'text' =&gt; $d['country'],
           'nodes' =&gt; array()  
         ); 
      }
      if(!isset($data[$d['country']]['nodes'][$d['name']])) {
          $data[$d['country']]['nodes'][$d['name']] = array(
            'text' =&gt; $d['name'],
            'nodes' =&gt; array()
          );    
       }
      array_push($data[$d['country']]['nodes'][$d['name']]['nodes'], $d['n_doc']);
  }
  </code></pre>