doutang1884 2015-10-24 14:42
浏览 44

php在运行简单数学测试的localhost上太慢了

I was running this simple math test on my localhost:

$r = [1,2,3,4,5,6,7,8,9];

$result = FALSE;

while($result == FALSE){
    if(
        $r[0] + $r[1] - $r[2] == 4 &&
        $r[3] - $r[4] + $r[5] == 8 &&
        $r[6] * $r[7] - $r[8] == 8 &&
        $r[0] + $r[3] - $r[6] == 6 &&
        $r[1] * $r[4] - $r[7] == 2 &&
        $r[2] + $r[5] - $r[8] == 6){

        $result = TRUE;
        echo "<pre>";
        echo print_r($r);
        echo "</pre>";

    } else {

        shuffle($r);

    }
}

If run that exact code on phpfiddle.org I get an instant result of that equation, but if I run on my locahost it gets to point of giving me a max execution timeout (120).

I believe my PC is not the problem, I have good specs, Core I5, 8GB ram, etc, So i believe that there is something wrong with my Wamp PHP configuration that its making the problem.

Funny enough, if i refresh the browser a couple of times it gives me the result at the speed of the click.

How can I troubleshoot this?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?