# PHP - converting array into sub arrays

**URL:** <https://forum.kirupa.com/t/php-converting-array-into-sub-arrays/233863>\
**Category:** programming\
**Created:** [July 27, 2007, 3:59pm UTC](https://forum.kirupa.com/t/php-converting-array-into-sub-arrays/233863 "2007-07-27T15:59:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neolumi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/neolumi/32/1306_2.png) [@Neolumi](https://forum.kirupa.com/u/Neolumi)\
**Post date:** [July 27, 2007, 3:59pm UTC](https://forum.kirupa.com/t/php-converting-array-into-sub-arrays/233863/1 "2007-07-27T15:59:33Z")

</div>

Hi people, I’m sure theres a function or something for this but I havent found it yet. What I’ve got is a form posting the current values:

```php
Array ( [pr_quant_1] => 6 [pr_id_1] => 3 [pr_attr_1] => 1 [pr_quant_2] => 2 [pr_id_2] => 3 [pr_attr_2] => 2 )

```

What I need to get from this is an array for each pr\_(x)\_(n) increment, so:

```php
Array( [pr_quant] =>6 [pr_id] => 3 [pr_attr] => 1 )
Array( [pr_quant] =>2 [pr_id] => 3 [pr_attr] => 2 )

```

thanks!
