<p>Is there a way to change all the numeric keys to &quot;Name&quot; without looping through the array (so a php function)?</p>
<pre><code>[
    0 =&gt; 'blabla',
    1 =&gt; 'blabla',
    2 =&gt; 'blblll',
    // etc ...
]
</code></pre>

No, there is not, for starters, it is impossible to have an array with elements sharing the same key
```
```
$x =array(); 
$x['foo'] = 'bar' ; 
$x['foo'] = 'baz' ; #replaces 'bar'
```
```
Secondarily, if you wish to merely prefix the numbers so that
```
```
$x[0] --> $x['foo_0']
```
```
That is computationally implausible to do without looping. No php functions presently exist for the task of "key-prefixing", and the closest thing is
"extract"
which will prefix numeric keys prior to making them variables.
The very simplest way is this:
```
```
function rekey( $input , $prefix ) { 
    $out = array(); 
    foreach( $input as $i => $v ) { 
        if ( is_numeric( $i ) ) { 
            $out[$prefix . $i] = $v; 
            continue; 
        }
        $out[$i] = $v;
    }
    return $out;
}
```
```
Additionally, upon reading XMLWriter usage, I believe you would be writing XML in a bad way.
```
```
<section> 
    <foo_0></foo_0>
   <foo_1></foo_1>
   <bar></bar>
   <foo_2></foo_2>
</section>
```
```
Is not good XML.
```
```
<section> 
   <foo></foo>
   <foo></foo>
   <bar></bar>
   <foo></foo>
</section>
```
```
Is better XML, because when intrepreted, the names being duplicate don't matter because they're all offset numerically like so:
```
```
section => { 
    0 => [ foo , {} ]
    1 => [ foo , {} ]
    2 => [ bar , {} ]
    3 => [ foo , {} ] 
}
```
```