From: oliver at burtchen dot com Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: do...while(0)
Description: ------------ The while-condition for the example should be 1 and not 0. Expected result: ---------------- Advanced C users may be familiar with a different usage of the do..while loop, to allow stopping execution in the middle of code blocks, by encapsulating them with do..while (1), and using the break statement. The following code fragment demonstrates this: <?php do { if ($i < 5) { echo "i is not big enough"; break; } $i *= $factor; if ($i < $minimum_limit) { break; } echo "i is ok"; /* process i */ } while (1); ?> Actual result: -------------- Advanced C users may be familiar with a different usage of the do..while loop, to allow stopping execution in the middle of code blocks, by encapsulating them with do..while (0), and using the break statement. The following code fragment demonstrates this: <?php do { if ($i < 5) { echo "i is not big enough"; break; } $i *= $factor; if ($i < $minimum_limit) { break; } echo "i is ok"; /* process i */ } while (0); ?> -- Edit bug report at http://bugs.php.net/?id=29077&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29077&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29077&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29077&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29077&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29077&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29077&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29077&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29077&r=support Expected behavior: http://bugs.php.net/fix.php?id=29077&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29077&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29077&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29077&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29077&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29077&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29077&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29077&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29077&r=float