Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' on line 12


#1

Please what is wrong with this code.I have been cracking my head







<?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

"$loopCond = false;" should be within your while loop, otherwise you create an infinite loop because the condition is still true and the while loop will continue.

It should look like this:

<?php
$loopCond = true;
while ($loopCond){
	//Echo your message that the loop is running below
	echo "<p>The loop is running.</p>";
	$loopCond = false;
}
echo "<p>And now it's done.</p>";
?>