SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Busch's Avatar
    Join Date
    Jan 2004
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    $var = <<<EOD fail after server move

    all my uses of
    PHP Code:
    $var = <<<EOD
    <html>here</html>
    EOD; 
    are now producing errors on every page i use it on after i changed servers.

    any idea how i can fix this? i would hate to have to edit the all my files and replace EOD with quotes. I know it's the EOD because once i do remove them, the scripts run fine.

    eric

  2. #2
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is very important to note that the line with the closing identifier contains no other characters, except possibly a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs after or before the semicolon.
    Probably the nastiest gotcha is that there may also not be a carriage return (\r) at the end of the line, only a form feed, AKA newline (). Since Microsoft Windows uses the sequence \r as a line terminator, your heredoc may not work if you write your script in a Windows editor. However, most programming editors provide a way to save your files with a UNIX line terminator.

  3. #3
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Busch
    all my uses of
    PHP Code:
    $var = <<<EOD
    <html>here</html>
    EOD; 
    are now producing errors on every page i use it on after i changed servers.

    any idea how i can fix this? i would hate to have to edit the all my files and replace EOD with quotes. I know it's the EOD because once i do remove them, the scripts run fine.

    eric
    PHP Code:
    $var = <<<EOD(NO Space)
    <
    html>here</html>
    EOD;(NO Space


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •