timeout problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

timeout problem

Post 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
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

you are incrementing the wrong value in your for loop. increment $z instead.
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

thanks

Post by uberpolak »

ahh, stupid error slips by once again, thanks for your help
Post Reply