ID:               38547
 Updated by:       [EMAIL PROTECTED]
 Reported By:      pb at tdcspace dot dk
-Status:           Open
+Status:           Bogus
 Bug Type:         Documentation problem
 Operating System: xxx
 PHP Version:      Irrelevant
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

It is not a loop, but a control block. It should end after one pass
(thus while false). Please read the paragraph before the example again.


Previous Comments:
------------------------------------------------------------------------

[2006-08-22 15:18:04] pb at tdcspace dot dk

Description:
------------
manual bug (up to latest rel. at 12 aug 2006) :

Chapter 16. Control Structures 

do-while
--------

a do-while example loop is shown (the man. ex. below) which
should be endless by using "while (0);" where (0) indicates a false
condition. note: the endless condition is used to illustrate the
"break" statement to exit the loop instead.

the loop will terminate at once with while(0) - the correct syntax is
while (1) or while(true) to make a endless loop.



Reproduce code:
---------------
<?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 this bug report at http://bugs.php.net/?id=38547&edit=1

Reply via email to