Let's say I have this array in PHP
Array(
[0] => Array
(
[DLVRD] => 2
[FAILED] => 1
[REJECT] => 4
[QUEUED] => 5
)
[1] => Array
(
[DLVRD] => 5
[FAILED] => 0
[REJECT] => 3
[QUEUED] => 2
)
[2] => Array
(
[DLVRD] => 3
[FAILED] => 0
[REJECT] => 1
[QUEUED] => 3
)
)
And I want to do is to have result something like this
Array
(
[DLVRD] => 10
[FAILED] => 1
[OTHERS] => 8
)
Currently my PHP code is like this:
foreach($GetTelcosRevenue as $telco) {
if($telco['dr_detail'] == 'DLVRD') {
$TelcoRevenue .="DLVRD:".$telco['TheTraffics'].",";
}
else if($telco['dr_detail'] == 'FAILED') {
$TelcoRevenue .="FAILED:".$telco['TheTraffics'].",";
}
else {
?????
}
}
}
I have tried to put $Others += $telco['TheTraffics'] and other hacks but I still got wrong result. Thanks for any help