|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #38547 manual bug
Submitted: 2006-08-22 15:18 UTC Modified: 2006-08-22 15:32 UTC
From: pb at tdcspace dot dk Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: xxx
Private report: No CVE-ID: None
 [2006-08-22 15:18 UTC] pb at tdcspace dot dk
manual bug (up to latest rel. at 12 aug 2006) :

Chapter 16. Control Structures 


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:
do {
    if ($i < 5) {
        echo "i is not big enough";
    $i *= $factor;
    if ($i < $minimum_limit) {
   echo "i is ok";

    /* process i */

} while (0);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-22 15:32 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

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.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jun 22 15:01:24 2021 UTC