"heredoc" problem
Posted: Wed Apr 09, 2014 10:06 am
As a new learner of PHP, I'm trying to test heredoc with the following code :
Unfortunately, I'm getting the following error : [text]
Parse error: syntax error, unexpected end of file in /opt/lampp/htdocs/chapter4/table1.php on line 18[/text]
After some searching I found that, this error message could show if there is any space between the tags. I've checked several times but no luck. same error again & again!!!
Experts please help me overcome this message. Thanks in advance.
Code: Select all
<?php
$movie=<<<EOD
<h2><center>Movie Review Database</center></h2>
<table width="70%" border="1" cellpadding="2" cellspacing="2" align="center">
<tr>
<th>Movie Title</th>
<th>Year of Release</th>
<th>Movie Director</th>
<th>Movie Lead Actor</th>
<th>Movie Type</th>
</tr>
</table>
EOD;
echo $movie;
?>Parse error: syntax error, unexpected end of file in /opt/lampp/htdocs/chapter4/table1.php on line 18[/text]
After some searching I found that, this error message could show if there is any space between the tags. I've checked several times but no luck. same error again & again!!!
Experts please help me overcome this message. Thanks in advance.