Reputation: 128
I created a array which stores XML elements in it.
$itemArray = array();
$itemArray[] = array ('[{id:'.$item.'species:'.$gender.'}]');
Now I used array_chunk to split the Array in 3 item parts.
$arrayChunked = array_chunk($itemArray, 3, true);
If I use:
var_dump($arrayChunked);
then the stored Items look like this:
0 => array(0,1,2)
1 => array(3,4,5)
2 => array(6,7,8)
But i need them stored like:
0 => array(0,1,2)
1 => array(0,1,2)
2 => array(0,1,2)
Any Idea of how i could do this?
Upvotes: 0
Views: 94
Reputation: 14956
Stop passing "true" as the third argument; you're telling it to preserve the original keys. If you take that out, it will reindex it automatically (as noted in the array_chunk docs).
i.e.
$arrayChunked = array_chunk($itemArray, 3);
Upvotes: 2