0

Hi,

Im having a problem with the following code of mine:

<?php 
    require_once 'config.php'; 
    $title = "Home!";
    $content = <<<EOF
        <h3>Current Statistics</h3>   
        Our Home Page!      
        EOF;    
        include 'layout.php';
?>

when i try and render the page i get the follwing error:

Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_END_HEREDOC or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in C:\wamp\www\sandbox\coding\system\newsletter\admin\index.php on line 9

please help me fix this....sooooo frustrated!!!

2
Contributors
1
Reply
10
Views
3 Years
Discussion Span
Last Post by cereal
0

Remove all the spaces at the left side of EOF; and then go to a new line, so remove also any spaces after EOF;, so:

<?php 
    require_once 'config.php'; 
    $title = "Home!";
    $content = <<<EOF
        <h3>Current Statistics</h3>   
        Our Home Page!      
EOF;
        include 'layout.php';
?>

From documentation:

The closing identifier must begin in the first column of the line.

And:

Warning
It is very important to note that the line with the closing identifier must contain no other characters, except a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs before or after the semicolon. It's also important to realize that the first character before the closing identifier must be a newline as defined by the local operating system.

Source:

Bye :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.