"Parse error: parse error, unexpected $ " for here

Hi
i am facing the following error due to use of heredoc “<<<” :

“Parse error: parse error, unexpected $ in D:xamppxampphtdocstestherdoc.php on line 31”

the code is as bellow :

	<?php
	
		 $str = <<<EOD
			 <td width="100%"><h1 style="background-color:#CCCCCC">Set Answers</h1></td>
			 </tr>
			 <tr>
			 <td align="center"></td>
			 </tr>
			 <tr>
			 <td align="center"><div>sdf</div></td>
			 </tr>
			 <tr>
			 <td align="center"></td>
			 </tr>
			 <tr>
			 <td align="center"><textarea name="textarea"></textarea></td>
			 </tr>
			 <tr>
			 <td align="center"></td>
			 </tr>
			 <tr>
			 <td align="center"><label>
			 <input type="submit" style="border-bottom:#9999FF" />
			 </label></td>
			EOD;			
				
		echo $str;	
			
	
		
		?>

What is the prob is the above code and how to solve it properly.

thanking you
Tanvir.

i don’t think it’s a heredoc problem.

maybe there is a closing ‘}’ missing.

Try this

[php]

<?php $str = "<<<EOD

Set Answers

sdf
EOD; " echo $str; ?>

[/php]

@andy: http://php.net/heredoc

Sponsor our Newsletter | Privacy Policy | Terms of Service