#43787 [Asn->Csd]: [DE] Documentation bug at "do...while"-doc

From: Date: Mon, 09 Feb 2009 17:19:11 +0000
Subject: #43787 [Asn->Csd]: [DE] Documentation bug at "do...while"-doc
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1820@lists.php.net to get a copy of this message
ID: 43787 Updated by: sammywg@php.net Reported By: f dot ach at web dot de -Status: Assigned +Status: Closed Bug Type: Translation problem PHP Version: Irrelevant Assigned To: sammywg New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2008-01-08 23:29:12] felipe@php.net 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. ------------------------------------------------------------------------ [2008-01-08 19:37:07] 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) Best Friedo ------------------------------------------------------------------------ [2008-01-08 16:30:48] bjori@php.net ..the German translation is however missing some explanations on the example. ------------------------------------------------------------------------ [2008-01-08 16:19:45] bjori@php.net 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 14:48:23] f dot ach at web dot de Description: ------------ There is a mistake in the documentation for do...while: Closing the do...while with }while(0); as documented in "http://de2.php.net/manual/de/control-structures.do.while.php" will cause only one run of the loop. Correctly it should be: }while(true); Reproduce code: --------------- $a = 0; do{ echo $a; $a = $a + 1; if ($a>5) break; }while(0) Expected result: ---------------- 0 1 2 3 4 5 Actual result: -------------- 0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43787&edit=1

« previous php.doc.bugs (#1820) next »