3 ms·
Well how about this then.
foreach(array(1,2,3,4,5) as $x) $i=$i+$x; echo $i;
Well how about this then.
foreach(array(1,2,3,4,5) as $x) $i=$i+$x; echo $i;
The array_reduce answers get closer to what I was looking for. This might be a "one line" answer, but it requires two special forms, assignment, sequencing operators (;), and two fresh variables.
This works, is fast enough and readable. Perfectly fine solution to me.