shamuraq Posted August 17, 2009 Share Posted August 17, 2009 Hi there, I try to control the output of this code: $multiplier = rand(2,7); //Get value of second volume via $multiplier //Making sure value of second volume is not greater than 10,000 to control array only up to 4 do { $lml_2 = $lml_1 * $multiplier; } while ($lml_2 > 10000); and i get this error: Fatal error: Maximum execution time of 30 seconds exceeded in volume02.php on line 26 Is there any alternative to the do() while() function? Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted August 17, 2009 Share Posted August 17, 2009 Well what's the value of $lml_1? The condition to execute your loop is dependent on $lml_2 = $lml_1 * $multiplier being less than 10000; but if it isn't, the loop will never exit at all and you will eventually time out. Why are you even using a do while loop here? Quote Link to comment Share on other sites More sharing options...
shamuraq Posted August 18, 2009 Author Share Posted August 18, 2009 Its because $lml_1 is produced with rand(); So for 100% exceeding 10,000 is impossible. Sadly, so is vice versa. I have other options but since i am in my transitional state of understanding PHP, i just wanna learn my options. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 18, 2009 Share Posted August 18, 2009 Its because $lml_1 is produced with rand(); Where? You're setting $multiplyer with rand() $multiplier = rand(2,7); $lml_1 is not even defined in the code you posted. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.