I get a message, when I run this code:
function print_footer(){
global $file;
echo <<<EOT
<center>
<a href="$file?op=vote"> Vote </a> |
<a href="$file?op=admin"> Admin </a> |
<hr>
$copy; 2012, Shibbir Ahmed, All Rights Reserved.
</center>
</body>
</html>
EOT;
}
Error Message:
Parse error: syntax error, unexpected $end in D:\xampp server\xampp\htdocs\practice
\function.php on line …
What’s wrong in this PHP code?
The code you have posted here have a bunch of spaces after the ending
EOT;. That is not allowed in the PHP syntax:What happens is that PHP does not see your ending specifier and it therefore continues to look for one, until it unexpectedly reaches the end of the file and throws an error.
The solution is to make sure you have no spaces at all on the line where you have
EOT;, neither before or after.