$array = array('1','2','3','4','5');
is there anyway i can get '15' without traversing the array and counting the values myself?
Not that im aware of 🙁 Guess you have to do it the old fashion way 🙂
$total = 0; for ($x=0; $x < count($array); $x++) { $total += $array[$x]; }
Hi Michael,
ofcourse there is a function for this. read about array_sum: http://www.php.net/manual/en/function.array-sum.php
greetings