I have got an array which is similar to this:
Array
(
[0] => Array
(
[cartId] => 51
[attributeId] => 171
[Value] => 34
[quantity] => 1
)
[1] => Array
(
[cartId] => 51
[attributeId] => 170
[Value] => Adult
[quantity] => 1
)
[2] => Array
(
[cartId] => 52
[attributeId] => 171
[Value] => 36
[quantity] => 1
)
[3] => Array
(
[cartId] => 52
[attributeId] => 170
[Value] => Adult
[quantity] => 1
)
)
I want rearrange it this way:
Array
(
[51] => Array
(
[171] => 34
[170] => Adult
)
[52] => Array
(
[171] => 36
[170] => Adult
)
)
Basically what i want is the cartId will be parent key and attributeId will be sub-key and value will be its respective value and all records will come under one cartId.
Thanks in advance.