title: PHP: Which is faster - array_sum or a foreach?
body: <p>I'm trying to work out which method would be faster (if either would be?). I've designed a test here: <a href="http://codepad.org/odyUN0xg" rel="nofollow">http://codepad.org/odyUN0xg</a></p>
  
  <p>When I run that test my results are very inconsistent. Both vary wildly. </p>
  
  <p><strong>Is there a problem with the test?</strong></p>
  
  <p>otherwise, <strong>can anyone suggest which one would or wouldn't be faster??</strong></p>
  
  <h3>Edit</h3>
  
  <p>Okay guys, thanks I've edited the codepad here: <a href="http://codepad.org/n1Xrt98J" rel="nofollow">http://codepad.org/n1Xrt98J</a>
  With all the comments and discussion i've decided to go with array sum. As soon as I used that microtime(true) thing it started to look alot faster (array_sum)</p>
  
  <p>Cheers for the advice, oh and I've added a "for" loop so that results are more even, but as noted on the results there is little time saving if any over a foreach.</p>