2 dimensional array sum the value
sum a specific data of a 2-dimensional array in PHP,
$products = [
[
'id' => 1,
'name' => 'Water',
'price' => 2,
],
[
'id' => 2,
'name' => 'Ball',
'price' => 3,
],
];
$sum = array_sum(array_column($products, 'price')); // 5