vipsa Posted January 22, 2014 Share Posted January 22, 2014 (edited) 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 Edited January 22, 2014 by vipsa Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/285574-unexpected-end-of-file/#findComment-1466129 Share on other sites More sharing options...
Solution Barand Posted January 22, 2014 Solution 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; ?> Quote Link to comment https://forums.phpfreaks.com/topic/285574-unexpected-end-of-file/#findComment-1466142 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.