note 73591 deleted from control-structures.do.while by nlopess

From: Date: Sun, 18 Mar 2007 12:36:32 +0000
Subject: note 73591 deleted from control-structures.do.while by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-124562@lists.php.net to get a copy of this message
Note Submitter: sammy at thestags ---- Not entirely sure what that script is meant to do, but pretty sure it should be while(1) [not while(0)] Here's a perhaps clearer example which repeatedly multiple a number by 0.2 until it becomes less than 5. <?php $i = 1000000; $factor = 0.2; do { echo "i = $i. "; if ($i < 5) { echo "i is not big enough"; break; } else { echo "i is ok<br>"; } /* process i */ $i *= $factor; } while (1); ?> This outputs i = 1000000. i is ok i = 200000. i is ok i = 40000. i is ok i = 8000. i is ok i = 1600. i is ok i = 320. i is ok i = 64. i is ok i = 12.8. i is ok i = 2.56. i is not big enough

« previous php.notes (#124562) next »