spelltwister Posted March 9, 2006 Share Posted March 9, 2006 Hello,First off, I was wondering if this is a PHP error or a server error and if it is, how do i make the time increase: Fatal error: Maximum execution time of 30 seconds exceeded in /home/online/public_html/...Second, because the script is timing out, i was wondering if someone could help me with an array question.I have an array: $offense_infantry = array( "number" => array(), "nation" => array() );What happens is a bunch of infantry pieces go into this array and they can have different numbers to represent how many are there. During combat, I do this:$upper = sizeof($offense_infantry["nation"]); $index = rand(0,$upper-1); if($offense_infantry["number"][$index] > 0){ $attInfantry--; $offense_infantry["number"][$index] -= 1; $k+=1; } if($offense_infantry["number"][$index] ==0){ unset($offense_infantry["number"][$index]); unset($offense_infantry["nation"][$index]); }Ok, now that it's unset, I don't want to be able to hit that unit again, i want it out of the array and all the rest smushed together. Is this right? Also, after each combat, i want to unset all my arrays, can i just do this:unset($offense_infantry); ?Thanks.Mike Link to comment Share on other sites More sharing options...
littlened Posted March 9, 2006 Share Posted March 9, 2006 [!--quoteo(post=353089:date=Mar 9 2006, 12:16 AM:name=spelltwister)--][div class=\'quotetop\']QUOTE(spelltwister @ Mar 9 2006, 12:16 AM) [snapback]353089[/snapback][/div][div class=\'quotemain\'][!--quotec--]Hello,First off, I was wondering if this is a PHP error or a server error and if it is, how do i make the time increase: Fatal error: Maximum execution time of 30 seconds exceeded in /home/online/public_html/...Second, because the script is timing out, i was wondering if someone could help me with an array question.I have an array: $offense_infantry = array( "number" => array(), "nation" => array() );What happens is a bunch of infantry pieces go into this array and they can have different numbers to represent how many are there. During combat, I do this:$upper = sizeof($offense_infantry["nation"]); $index = rand(0,$upper-1); if($offense_infantry["number"][$index] > 0){ $attInfantry--; $offense_infantry["number"][$index] -= 1; $k+=1; } if($offense_infantry["number"][$index] ==0){ unset($offense_infantry["number"][$index]); unset($offense_infantry["nation"][$index]); }Ok, now that it's unset, I don't want to be able to hit that unit again, i want it out of the array and all the rest smushed together. Is this right? Also, after each combat, i want to unset all my arrays, can i just do this:unset($offense_infantry); ?Thanks.Mike[/quote]the error message your getting something that is set in the PHP.ini file, which looks like it's set to 30 seconds, so a php script cannot take more than 30 seconds to complete. Link to comment Share on other sites More sharing options...
spelltwister Posted March 11, 2006 Author Share Posted March 11, 2006 Thanks, I fixed that problem, but can anyone tell me how to remove an element from an array and shift everything else down so that it cannot be selected again and the size go down 1 as well? Thanks Link to comment Share on other sites More sharing options...
Barand Posted March 12, 2006 Share Posted March 12, 2006 This is same question I have answered in your other post. Don't double post. READ FORUM GUIDELINES. Link to comment Share on other sites More sharing options...
Recommended Posts