Why I can't run my code?


#1

I am submitting the following code and it doesn't say anything I don't know why!







<?php
$loopCond = true;
while ($loopCond == true){
//Echo your message that the loop is running below
echo "

The loop is running.

";
$loopcond="false";
}
echo "

And now it's done.

";
?>


#2

@vkasturi

Look at your $loopcond = "false" in line 6. Shouldn't there be a capital on C?

Hint

Look at this code: $loopCond = true;


#3

Not to mention that you're not supposed to have quotation marks around "false". Look at your $loopCond = true;
:wink:


#4







<?php
$loopCond = true;
while ($loopCond == true){
echo"

The is your last chancy fancy pancy

";
}
$loopCond = false;
echo "<p>And now it's done.</p>";
?>
</body>

why ???? doesn't say anything
I don't know why


#5

@omidkeihani

Take the habit of posting your problems in a new thread instead of replying directly to an already created topic. But since you might be impatient of wanting this exercise to be completed, I'll tell you how to do it.

You are generating an infinite loop, causing the browser to crash.

Why

  1. You set $loopCond to false
  2. You create a loop that is going to echo some text as long as the condition is true
  3. The condition is always true because you didn't change the value of $loopCond to false in the loop.
  4. The page takes too long to load because he have to generate an infinite amount of text because the condition in the loop is always true and the browser crashes.

Summary of what I just said

Move your $loopCond variable inside the loop.