how to add fare if the data generated like this ? so that there can be the total number of tariff how to add fare if the data generated like this ? so that there can be the total number of tariff
Array
(
[3] => Array
(
[TARIFF] => 0
)
[4] => Array
(
[TARIFF] => 0
)
[2] => Array
(
[TARIFF] => 29500
)
[0] => Array
(
[TARIFF] => 20500
)
[1] => Array
(
[TARIFF] => 14500
)
)
array_sum(array_column($array, 'TARIFF'));array_reduce($array, function($runningTotal, $value) { $runningTotal += $value['TARIFF']; return $runningTotal; }, 0);