>for ($x=0; $x < 10; ++$x) {
>
>if ( (0 === ($x % 1000)) && (time () - $start_time) > $timeout)
>break;
>
>echo ($x, '');
>}
I am a little bit conservative when it comes to use
the break-statement, and the rule of thumb I uses is;
any singular block sh
U R right Zak, I'm a bit dizzy today, thanx.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
Johan Lundqvist wrote:
> This is a way of doing it:
>
> $s = time() + 10;
> for ($i = time(); $i <= $s; $i++) {
> print $i;
> }
>
> Will run for about ten seconds...
Did you leave a bit of code out?
In most cases, this will run for only a few milliseconds. :)
Try something like
This is a way of doing it:
$s = time() + 10;
for ($i = time(); $i <= $s; $i++) {
print $i;
}
Will run for about ten seconds...
/Johan
Brendan Gogarty wrote:
>
> hi,
> just wondering if there was any easy way to break/escape from a loop
> (for loop) if the loop exceeds a maximum time.
> I r
hi,
just wondering if there was any easy way to break/escape from a loop
(for loop) if the loop exceeds a maximum time.
I realise that set_timeout applies to the whole script but i am just
interested in a sub function of the script.
cheers!
brendan.
--
PHP Windows Mailing List (http://www.p