I have an multidimensional array where if 3 values are the same, I want to combine them and add other values together. Here's the array:
As you can see, the first 3 entries have the same date, shift, and title. I combine those into a new array and add each slots value together. So, the above array would combine to:
Can't for the life of me, figure out how to do that. Thoughts? TIA
DreamerZ
Code:
Array
(
[0] => Array
(
[date] => 1127977200
[strDate] => 09/29/2005
[shift] => Day
[title] => COMPUTER_OPERATOR
[slots] => 1
)
[1] => Array
(
[date] => 1127977200
[strDate] => 09/29/2005
[shift] => Day
[title] => COMPUTER_OPERATOR
[slots] => 1
)
[2] => Array
(
[date] => 1127977200
[strDate] => 09/29/2005
[shift] => Day
[title] => COMPUTER_OPERATOR
[slots] => 1
)
[3] => Array
(
[date] => 1127977200
[strDate] => 09/29/2005
[shift] => Day
[title] => SSA
[slots] => 1
)
[4] => Array
(
[date] => 1128063600
[strDate] => 09/30/2005
[shift] => Day
[title] => SSA
[slots] => 1
)
)
As you can see, the first 3 entries have the same date, shift, and title. I combine those into a new array and add each slots value together. So, the above array would combine to:
Code:
Array
(
[0] => Array
(
[date] => 1127977200
[strDate] => 09/29/2005
[shift] => Day
[title] => COMPUTER_OPERATOR
[slots] => 3
)
[1] => Array
(
[date] => 1127977200
[strDate] => 09/29/2005
[shift] => Day
[title] => SSA
[slots] => 1
)
[2] => Array
(
[date] => 1128063600
[strDate] => 09/30/2005
[shift] => Day
[title] => SSA
[slots] => 1
)
)
Can't for the life of me, figure out how to do that. Thoughts? TIA
DreamerZ