douheng8629 2013-03-31 09:59 采纳率: 100%
浏览 81
已采纳

PHP中的foreach数量有限吗?

I don't know is it right or not. I have a PHP file with contents like this:

$x = explode("
", $y); // Making $x has length 65000
foreach ($x as $k) {
    //Some code here
}

And often my script auto-stopping after ~25000 loops. Why? Is it PHP default configuration?

  • 写回答

3条回答 默认 最新

  • dr9379 2013-03-31 10:12
    关注

    This behaviour can be because of 2 reasons

    1. The script execution time is more than allocated to it ... Try increasing max_execution_time in php.ini .

    2. The memory limit of script may be more than allocated .For this try changing the value of memory_limit in php.ini

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?