Possible Duplicate:
heredoc with eval code execution
So I have the following in function.php:
eval("\$content = <<<TEMPLATE\n
asdf
\nTEMPLATE;");
And I keep getting an error saying:
Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_END_HEREDOC or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /var/www/function.php(10) : eval()'d code on line 5
I cannot figure out what the problem is. There is obviously an ending for the heredoc syntax, does heredoc just not like to play nice with eval?
HEREDOC syntax is ended by the delimiter defined at the start, followed by a semicolon, followed by a newline. You do not have the newline, therefore it is not being recognised as the end of the HEREDOC. Add an extra
\nafterTEMPLATE;and it should work fine.