2021年2月10日星期三

php simple rand() look up taking long / crashing browser?

I'm running this code:

$n1 = rand(1,20);  $n2 = rand(1,20);  echo '<p>Looking for ' . $z1;  echo '<p>looking....<br><br>';  for ($i = 1; $n1 != $n2; $i ++) {    $n2 = rand(1,10);  }    echo '<p>I tried ' . $i . ' times.</p>';  

First loads of the page are usually super fast. Then suddenly:

Fatal error: Maximum execution time of 120 seconds exceeded

It's either working super fast or crashing. Can someone help me understand why this is?

Thank You

https://stackoverflow.com/questions/66147070/php-simple-rand-look-up-taking-long-crashing-browser February 11, 2021 at 08:19AM

没有评论:

发表评论