1<?php
2$items = [
3 ['label' => 'cake', 'name' => 'Cake', 'price' => 150],
4 ['label' => 'pizza', 'name' => 'Pizza', 'price' => 250],
5 ['label' => 'puff', 'name' => 'Veg Puff', 'price' => 20],
6 ['label' => 'samosa', 'name' => 'Samosa', 'price' => 14]
7];
8
9$arrSum = array_sum(array_column($items, 'price', 'name'));
10print "Sum of Array : ".$arrSum."<br/>";
11?>
1Return the sum of all the values in the array (5+15+25):
2
3<?php
4$a=array(5,15,25);
5echo array_sum($a);
6?>