>    for ($x=0; $x < 1000000000; ++$x) {
>
>        if ( (0 === ($x % 1000)) && (time () - $start_time) > $timeout)
>            break;
>
>        echo ($x, '<br>');
>    }

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 should have one defined entry point
an one defined exit point. A break statement will break
that rule. According to this rule I would prefer to write
it like:

bTimeOut = false;

for ($x=0; $x < 1000000000 && !bTimeOut; ++$x) {

  /* some statements what so ever.... */

  if ( (0 === ($x % 1000)) && (time () - $start_time) > $timeout) {
         bTimeOut = true;
  }
}

Now the code have one entry point and one exit point. Also there
is a small little extra bonus with this: it's quite clear from
the style of the code what the intention to do is.

-- 
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]

Reply via email to