duandao3265 2015-09-10 09:27
浏览 99
已采纳

致命错误:超出最长执行时间120秒

Good day everyone, I'm trying . This is the code which demonstrates what I'm doing:

 <?php
$NoOfGames = 10;
$time = array("06:00:00 " => "07:00:00", "07:00:00" => "08:00:00", "08:00:00" => "09:00:00", "09:00:00" => "10:00:00", "10:00:00" => "11:00:00", "11:00:00" => "12:00:00","12:00:00" => "13:00:00","13:00:00" => "14:00:00","14:00:00" => "15:00:00","15:00:00" => "16:00:00","16:00:00" => "17:00:00","17:00:00" => "18:00:00");

for($i=0;$i<$NoOfGames;$i+1){
    $start_time = array_rand($time);
    $end_time = $time[$start_time];
    $time_new[$start_time] = $end_time;
}
$i =1;
foreach($time_new as $start => $end)
{

    echo  $i. ") ". $start . " to ".  $end . "<br>";
    $i++;
}
?>

However, this outputs it keeps showing this fatal error message

and I want to display it like this instead

1) 17:00:00 to 18:00:00
2) 06:00:00 to 07:00:00
3) 12:00:00 to 13:00:00
4) 11:00:00 to 12:00:00
5) 16:00:00 to 17:00:00
6) 08:00:00 to 09:00:00
7) 13:00:00 to 14:00:00
8) 15:00:00 to 16:00:00
9) 14:00:00 to 15:00:00
10) 09:00:00 to 10:00:00
  • 写回答

1条回答 默认 最新

  • duanji2002 2015-09-10 09:29
    关注

    This should work:

    Change $i+1 to $i++

    The reason is that $i+1 just evaluates to 1 every time (ie doesn't actually increment $i), meaning the loop never exits.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog