Infinite loop broke the exercise 3 (Your First While Loop)


#1



I had write "=" not "==" at while and it had been saved. So now refreshing the page doesn't helps.
I am done the php course to 98% and I want to done it at all, but I cant save the right code on the lesson, please help.


<!DOCTYPE html>
<html>
    <head>
		<title>A loop of your own</title>
        <link type='text/css' rel='stylesheet' href='style.css'/>
	</head>
	<body>
    <?php
	//Add while loop below
    $a = 1;
    while ($a = 1) {
        echo "The Loop is going on";
        $a = 2;
    }
    ?>
    </body>
</html>


#2

@mikediam,
In your while( condition )
you are using the assignment operator,
but you should use a comparison operator
http://stackoverflow.com/questions/80646/how-do-the-php-equality-double-equals-and-identity-triple-equals-comp


#3

Yes, I am understand it, but when I reload the page, and write there comparision operator, it couldn't be saved cause the page is crashed - thats what I see http://prntscr.com/awj125


#4

I have the same problem.








<?php
//Add while loop below
while (1) {
echo "infinite";
}
?>



refresh doesn't work


#5

So, this makes no sense right? I mean, if its not showing me an output, how is it letting me go ahead?


#6

@akshaysonde,
In your =while= condition you should use a comparison operator like == or ===
http://stackoverflow.com/questions/80646/how-do-the-php-equality-double-equals-and-identity-triple-equals-comp

If you use a semi-colon-; it is interpreted as an End-of-Statement....
thus

while( $myName == "Akshay" );

you have created a =while= with NO attached code-block

or
if you use

if ( $myName == "Akshay" );

you have closed the IF statement and a following ELSE is NOT expected by the interpreter
http://stackoverflow.com/questions/6220440/what-does-if-do-where-the-semi-colon-is-right-after-the-parentheses


#7

how should i reset the code.refresh the page doesn't work.


#8

@webace97160,

++++ reset of session *****************
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).


#9

the code can't be reset ,i tried all you said.


#10

I have the same problem.
I've tried quite a few solutions, even different browsers.
The loop is saved on an infinite situation and then when you load the exercise, you cannot submit it because the exercise doesn't correctly load with the loop going at the autosaved state.