php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27214 Problem with "If statements" in "For Statemnets"
Submitted: 2004-02-10 17:30 UTC Modified: 2004-02-10 17:40 UTC
From: ryanlewellen at comcast dot net Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.5RC2 OS: Windows XP Professional
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ryanlewellen at comcast dot net
New email:
PHP Version: OS:

 

 [2004-02-10 17:30 UTC] ryanlewellen at comcast dot net
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-10 17:40 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

= != ==
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 11 09:02:40 2024 UTC