Page 1 of 1

timeout problem

Posted: Mon Jan 06, 2003 3:26 pm
by uberpolak
Can someone take a look at this and tell me why it keeps timing out? It looks to me like it should work:

Code: Select all

function randstring($zork)
{
 $alph = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
 $stringsofar = "";
 for ($z = 1; $z <= $zork; $zork++)
 {
  $stringsofar .= $alph[mt_rand(0,count($alph) - 1)]; ***
 }
 return $stringsofar;
}

***Line where it times out.
Thanks

Posted: Mon Jan 06, 2003 5:53 pm
by mydimension
you are incrementing the wrong value in your for loop. increment $z instead.

thanks

Posted: Mon Jan 06, 2003 6:38 pm
by uberpolak
ahh, stupid error slips by once again, thanks for your help