Get the sum of all rows of a multidimensional array in PHP

If you need to sum up all rows of a multidimensional array, be it an array of prices or posts or votes, in PHP you can do that like this:

<?php
$votes = array(
    array('votes_a' => 10, 'votes_b' => 1),
    array('votes_a' => 20,  'votes_b' => 2),
    array('votes_a' => 30, 'votes_b' => 3)
);

$result = [];

foreach($votes[key($votes)] as $key => $value) {
    $result[$key] = array_sum(array_column($votes, $key));
}
print_r($result);

Result:

Array
(
[votes_a] => 60
[votes_b] => 6
)