For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > August 2006 > #38547 [Opn->Bgs]: manual bug









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #38547 [Opn->Bgs]: manual bug
ohill@php.net

2006-08-22, 6:57 pm

ID: 38547
Updated by: ohill@php.net
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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com