SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)

    Question Parse Errror: unexpected $end (not the usual symptoms)

    I've been getting the dreaded 'unexpected $end' message. I tested my setup with the simple test below and still get it. Here is the test code and some caveats. Does anybody know why I might still be getting this message?

    PHP Code:
    <?php

    class Skin
    {

    public static function 
    Test()
    {
    echo <<<EOF
    'hello world'
    EOF;
    }

    }

    ?>
    Here are the caveats:

    1) There are no short tags anywhere.
    2) There are no unclosed () or {} anywhere.
    3) There are no missing , or ; anywhere.
    4) There are no spaces before or after the final ?>.

  2. #2
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,397
    Mentioned
    63 Post(s)
    Tagged
    0 Thread(s)
    What is the full error message?
    Salathe
    Software Developer and PHP Manual Author.

  3. #3
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The only thing I can guess is that your "EOF;" isn't the first thing on its line. In your code above there are no indents, but I hope that's just a code-paste thing and it's indented appropriately. However, make EOF; the very beginning thing on its line.

    Couple of notes to make - EOF means End Of File. You can use any word you wish there, so EOF (whilst conventional in tutorials) isn't a necessary thing to use. Also you don't need those quotes there either, unless they're there for a reason.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  4. #4
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I tested it and didn't get any errors.

  5. #5
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jake Arkinstall View Post
    The only thing I can guess is that your "EOF;" isn't the first thing on its line. In your code above there are no indents, but I hope that's just a code-paste thing and it's indented appropriately. However, make EOF; the very beginning thing on its line.

    Couple of notes to make - EOF means End Of File. You can use any word you wish there, so EOF (whilst conventional in tutorials) isn't a necessary thing to use. Also you don't need those quotes there either, unless they're there for a reason.
    This was it. My code was, in fact, indented, including the ending EOF. =/

    Thanks. =)


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
  •