Yup.. you can do that.   Easiest way to find out is to give it a try :)

As long as your loop conditions don't conflict or you do stuff to change 
variables in a counter-productive way (ie. breaking your logic) then you 
should be ok.

-TG

----- Original Message -----
From: "Alan Willsher" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Date: Fri, 18 Apr 2008 02:51:02 +0100
Subject: [PHP] loop inside a loop

> Hi can you put a loop inside a loop?
> 
> what I want to do is have something looping every 1 second and then
> something else looping once every 10 seconds.
> 
> something like a combination of these two..
> 
> $x = 0;
> while ($x < 1000) {
> echo "1";
> $x++;
> sleep(1);
> }
> 
> $y = 0;
> while ($y < 100) {
> echo "2";
> $y++;
> sleep(10);
> }
> 
> but at the same time so it would output something like
> 
> 1111111111211111111112111111111121111111112
> 
> Thanks
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to