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!!!

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.