Parse error 3/7


#1

while ($i < 4){
echo "

number: {$i}

";
$i ++;
}
?>

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE on line 11 ----that is the error.. help me please.


#2

Try this instead

<?php
//initialize i to be 0
$i = 0;
//start loop
while ($i < 4){
	//print number 
	//(NB: added <br/> to print on separate lines)
	echo "number: {$i}<br/>";
	//increment i
	$i ++;
}
?>

The problem is that you had to put your echo statement on the same line. you cannot break it up like that or the interpreter will come to an unexpected end while parsing. Also you needed to initialize $i