I have an array that is looking like this:
Array
(
[0] => Array
(
[location_id] => 1
[property_id] => 10
)
[1] => Array
(
[location_id] => 2
[property_id] => 20
)
[2] => Array
(
[location_id] => 3
[property_id] => 10
)
[3] => Array
(
[location_id] => 4
[property_id] => 10
)
[4] => Array
(
[location_id] => 5
[property_id] => 10
)
[5] => Array
(
[location_id] => 6
[property_id] => 20
)
And my desired output will be like this, $array:
Array
(
[0] => Array
(
[location_id] => 6
[location_id] => 2
[property_id] => 20
)
[1] => Array
(
[location_id] => 3
[location_id] => 4
[location_id] => 5
[property_id] => 10
)
Basically for each property_id, add all the location_id when they correspond in the same array, like in the example.