Counting all the values in an array
Posted 19 March 2006 - 05:34 PM
I have an array $byteslist which contains a list of integers gathered from a MySQL database.
I am using the following code:
$totalbytes = array_sum($byteslist);
But I get the following error:
Fatal error: Maximum execution time of 30 seconds exceeded
Where am I going wrong?
Posted 19 March 2006 - 05:45 PM
How large is the array?
Display the array first
<?php echo '<pre>' . print_r($byteslist,true).'</pre>'; ?>
Posted 19 March 2006 - 07:27 PM
Posted 20 March 2006 - 09:15 AM
check any nearby loops (ie, perhaps a loop to fill the array) I normally time out on neverending loops if I forget something, but the actual line that it displays as timing out is sometimes only related to the loop, not actually in it
Thanks, you were right, I had that line of code within a while loop, once I took it out it worked fine.
Your help was much appreciated!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users