|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43787 [DE] Documentation bug at "do...while"-doc
Submitted: 2008-01-08 14:48 UTC Modified: 2009-02-09 17:19 UTC
From: f dot ach at web dot de Assigned: sammywg (profile)
Status: Closed Package: Translation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2008-01-08 14:48 UTC] f dot ach at web dot de
There is a mistake in the documentation for do...while:

Closing the do...while with 


as documented in ""

will cause only one run of the loop.

Correctly it should be:


Reproduce code:
$a = 0;
  echo $a;
  $a = $a + 1;
  if ($a>5) break;

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-08 16:19 UTC]
To quote the doc: "Don't worry if you don't understand this right away or at all. You can code scripts and even powerful scripts without using this 'feature'."

The example is correct.
 [2008-01-08 16:30 UTC]
..the German translation is however missing some explanations on the example.
 [2008-01-08 19:37 UTC] f dot ach at web dot de
I am sorry to answer you back, but a do...while loop simply runs only one time if closed by "while(0);"

In c this method works but in php "0" translates to "FALSE".

If you do not agree, simply check my example. (I did it 5 minutes ago)

 [2008-01-08 23:29 UTC]
The construction do..while wasn't used for do make a loop. It's used on example to create a scope, where the rest the code of same scope will not be executed after perfomed a break statement.
 [2009-02-09 17:19 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

 [2020-02-07 09:57 UTC]
Automatic comment on behalf of sammywg
Log: initial translation, fix bug #43787
 [2020-12-30 11:15 UTC]
Automatic comment on behalf of sammywg
Log: initial translation, fix bug #43787
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 25 21:03:33 2021 UTC