programming faqs interview questions tech technical educational freshers guide preparation interviews hr telephonic
try another color:
try another fontsize: 60% 70% 80% 90%
ProgrammingFAQs

How to find sum of elements of an array in php

Average: 3 (1 vote)

we can find sum of array

we can find sum of array elements using array_sum function

eg: create an array $arr = array(2,4,3,2,1);

$sum_of_elements = array_sum($arr);

echo $sum_of_elements; //12
It prints the 12.