vipsa Posted January 22, 2014 Share Posted January 22, 2014 I have this very simple lines of code: <!DOCTYPE html> <html> <head> <title> Chapter 5 Strings </title> </head> <body> <a href="index.php">Back home</a><br><br> <?php $mytext = <<<END_TEXT This is just a bunch of text I will write here so we can test a couple of things with text. I will add a few lines just so we have some. END_TEXT; ?> </body> </html> So I am getting this error Parse error: syntax error, unexpected end of file and I would like to know why as the syntax is correct Link to comment https://forums.phpfreaks.com/topic/285574-unexpected-end-of-file/ Share on other sites More sharing options...
vipsa Posted January 22, 2014 Author Share Posted January 22, 2014 Never mind I solved it Link to comment https://forums.phpfreaks.com/topic/285574-unexpected-end-of-file/#findComment-1466129 Share on other sites More sharing options...
Barand Posted January 22, 2014 Share Posted January 22, 2014 For the benefit of those with a similar problem there should be no whitespace on the closing line of a heredoc statement ie <?php $mytext = <<<END_TEXT This is just a bunch of text I will write here so we can test a couple of things with text. I will add a few lines just so we have some. END_TEXT; ?> Link to comment https://forums.phpfreaks.com/topic/285574-unexpected-end-of-file/#findComment-1466142 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.