Parse error: syntax error, unexpected $end in ... Question/Suggestion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wescotte

    Parse error: syntax error, unexpected $end in ... Question/Suggestion

    The error message Parse error: syntax error, unexpected $end in FILE on
    line X is one I run into frequently and I know the cause is I missed an
    ending quote.

    Is there an easy way to determine where the inital " started? I find
    myself adding /* */ blocks or cutting/pasting sections of code out in
    order to find where the error occured.

    Wouldn't it it be nice if the warning message included the line in teh
    source where the initial quote occured?

    for example say this is my code
    <?
    function Build_Query(... .)
    code...

    $my_query = "SELECT BLAH FROM ; (line 15)

    more code...

    } (line 100)
    EOF

    and you got

    Parse error: syntax error, unexpected $end in MYFILE on line 100
    started on line 15

    Just a thought
    Eric

  • Jiri Fogl

    #2
    Re: Parse error: syntax error, unexpected $end in ... Question/Suggestion

    > Is there an easy way to determine where the inital " started?

    Try some syntax-highlighting editor.

    Comment

    • Wescotte

      #3
      Re: Parse error: syntax error, unexpected $end in ... Question/Suggestion

      Can you suggest one?

      I use notepad for all my php coding and while I can google for one I'd
      like to know what other people use and why

      Thanks
      Eric

      Comment

      • no-1

        #4
        Re: Parse error: syntax error, unexpected $end in ... Question/Suggestion

        vim does a pretty good job... but that is just because I am already
        familiar with vi.

        Comment

        • Geoff Berrow

          #5
          Re: Parse error: syntax error, unexpected $end in ... Question/Suggestion

          Message-ID: <1144431165.624 770.55640@i40g2 000cwc.googlegr oups.com> from
          Wescotte contained the following:
          [color=blue]
          >I use notepad for all my php coding[/color]

          For a very easy to use Notepad replacement try notepad2


          --
          Geoff Berrow (put thecat out to email)
          It's only Usenet, no one dies.
          My opinions, not the committee's, mine.
          Simple RFDs http://www.ckdog.co.uk/rfdmaker/

          Comment

          • Justin Koivisto

            #6
            Re: Parse error: syntax error, unexpected $end in ... Question/Suggestion

            Wescotte wrote:[color=blue]
            > The error message Parse error: syntax error, unexpected $end in FILE on
            > line X is one I run into frequently and I know the cause is I missed an
            > ending quote.[/color]

            A missed end brace "}", bracket "]", or parenthesis ")" can also cause
            the unexpected $end in a script as well.

            --
            Justin Koivisto, ZCE - justin@koivi.co m

            Comment

            • Jiri Fogl

              #7
              Re: Parse error: syntax error, unexpected $end in ... Question/Suggestion

              Wescotte wrote:[color=blue]
              > Can you suggest one?
              >
              > I use notepad for all my php coding and while I can google for one I'd
              > like to know what other people use and why
              >
              > Thanks
              > Eric
              >[/color]

              I'm a Linux user and mostly work in Quanta (part of KDE) and Vim, but my
              friends using Windows like PSPad or phpEditorIDE. PSPad is free, for
              phpEditorIDE exists at least trial version (if it is not free too - I'm
              not sure).

              Comment

              • Wescotte

                #8
                Re: Parse error: syntax error, unexpected $end in ... Question/Suggestion

                Thank you very much! The visual brace matching made it incredibly easy
                to find my mistake

                Comment

                • Geoff Berrow

                  #9
                  Re: Parse error: syntax error, unexpected $end in ... Question/Suggestion

                  Message-ID: <1144436649.718 977.327370@v46g 2000cwv.googleg roups.com> from
                  Wescotte contained the following:
                  [color=blue]
                  >Thank you very much! The visual brace matching made it incredibly easy
                  >to find my mistake[/color]


                  Yes that's a great feature. :-)
                  --
                  Geoff Berrow (put thecat out to email)
                  It's only Usenet, no one dies.
                  My opinions, not the committee's, mine.
                  Simple RFDs http://www.ckdog.co.uk/rfdmaker/

                  Comment

                  Working...