|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-10 17:40 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 14:00:01 2025 UTC |
Description: ------------ When i put an IF statement inside a FOR statement, i ran into the problem that it went into an infinite loop. However, when i took out the IF statement, it did what i wanted it to do. Reproduce code: --------------- <?php echo ("This is a FOR STATEMENT <BR>"); $counter0=0; for ($counter0=0; $counter0<=100; $counter0++) { echo ("Pass # " . $counter0 . " is now in effect. <BR>"); if ($counter0=50) { echo ("Only 50 more to go!"); } } ?> Expected result: ---------------- It would create 100 lines in a webpage, with increasing values, and at 50, it would echo "Only 50 more to go!" and continue on. Actual result: -------------- It started at 0, jumped to 50, and ran into an infinite loop. See for yourself.