I have a single, multidimensional array that has multiple parts. Some of them are duplicates such that there are 2 (or more) different entries for the same part, most of the data is the same, but there are different pricing options, it looks lie this:
Array
(
[0] => Array
(
[number] => 1234
[description] => Part Name 1
[e_price] => 14.40
)
[1] => Array
(
[number] => 1234
[description] => Part Name 1
[s_price] => 17.10
)
[2] => Array
(
[number] => 9876
[description] => Part Name 2
[b_price] => 26.10
)
[3] => Array
(
[number] => 9876
[description] => Part Name 2
[e_price] => 152.10
)
[4] => Array
(
[number] => 9876
[description] => Part Name 2
[s_price] => 179.10
)
[5] => Array
(
[number] => 2525
[description] => Part Name 3
[b_price] => 26.10
)
[6] => Array
(
[number] => 2525
[description] => Part Name 3
[e_price] => 152.10
)
[7] => Array
(
[number] => 2525
[description] => Part Name 3
[s_price] => 179.10
)
I want to combine all the items with the same part number into a single entry, and end up with the following results:
Array
(
[0] => Array
(
[number] => 1234
[description] => Part Name 1
[e_price] => 14.40
[s_price] => 17.10
)
[1] => Array
(
[number] => 9876
[description] => Part Name 2
[b_price] => 26.10
[e_price] => 152.10
[s_price] => 179.10
)
[2] => Array
(
[number] => 2525
[description] => Part Name 3
[b_price] => 26.10
[e_price] => 152.10
[s_price] => 179.10
)
I've tried using array_merge and array_unique, but I can't figure out how to merge them based on the part number when it's all in a single array to begin with.