Any script that I run that last more then like a second it halts until the max excution time limit hits.
if i run the code below for example it will time out on me. I did figure out if i use mt_rand() instead it lets me run it. but I think this is because it pushes the script speed below the time where this hang up happends.
I have had a few people test my script out and they can all run it with no problems. this problem is driving me insane. makes no sense why i cant run a script that takes more then a second.
I'm using XAMPP for windows version 1.7.7
- Code: Select all
ini_set("display_errors", "1");error_reporting(-1);
stargate_address_generator() {
$chevron1 = rand(1,38);
$chevron2 = rand(1,38);
while ($chevron1 == $chevron2) { $chevron2 = rand(1,38); }
$chevron3 = rand(1,38);
while ($chevron3 == $chevron1 || $chevron3 == $chevron2) { $chevron3 = rand(1,38); }
$chevron4 = rand(1,38);
while ($chevron4 == $chevron1 || $chevron4 == $chevron2 || $chevron4 == $chevron3) {$chevron4 = rand(1,38);}
$chevron5 = rand(1,38);
while ($chevron5 == $chevron1 || $chevron5 == $chevron2 || $chevron5 == $chevron3 || $chevron5 == $chevron4) {$chevron5 = rand(1,38); }
$chevron6 = rand(1,38);
while ($chevron6 == $chevron1 || $chevron6 == $chevron2 || $chevron6 == $chevron3 || $chevron6 == $chevron4 || $chevron6 ==
$chevron5) { $chevron6 = rand(1,38); }
$stargate_address = "$chevron1-$chevron2-$chevron3-$chevron4-$chevron5-$chevron6";
return $stargate_address;
}
function stargate_address_check() {
$map_x = 20;
$map_y = 20;
$stars_per_sector = 15;
$star_amount = $map_x * $map_y * $stars_per_sector;
$stargate_address_array = '';
$create_address_array = 0;
for ($i=0; $i<$star_amount; $i++){
do {
$address = stargate_address_generator();
}
while (isset($stargate_address_array[$address]));
$stargate_address_array[$address] = 1;
}
$count = count($stargate_address_array);
return $count;
}
echo stargate_address_check();