I have a for loop in my code. I did not change anything in this part of the code for 5-6 days, and I never had a problem with this.
Since yesterday, I tried to reload my code, and it always gives me this error:
Maximum execution time of 30 seconds exceeded - in LogController.php line 270
Well, I can’t explain why, but maybe one of you could check it out.
This is my code around line 270.
$topten_sites = []; for ($i = 0; $i <= count($sites_array); $i++) { if ($i < 10) { // this is 270 $topten_sites[] = $sites_array[$i]; } } $topten_sites = collect($topten_sites)->sortByDesc('number')->all();
Like I said, it worked perfectly, so why does this give me an error? If I uncomment these lines and every other line containing the $ topten_sites array, the code works again.
source share