The famous Parse error: parse error, unexpected T_STRING

Posted on 2006-05-10
Last Modified: 2013-12-12
Ok so I got this script thing installed on my site, and the line that I get this error is:

$nrsubscribed.="<font class="title"><center>"._ESOLUTIONNOTSUBSCRIBED."</font></center><br><br>";

Just off hand, can anyone see anything in there missing anything? Installation may be wrong, But Im just curious to see if anything is missing in here?

let me know

Question by:thechase22
    LVL 40

    Accepted Solution

    $nrsubscribed.="<font class=

    " <<<< this " close the one in the line above. As it is needed IN the string, you have to escape it to make it NOT behave like a closing string.



    As you are NOT including any PHP variables, use single quotes to enclose straight text.

    $nrsubscribed.='<font class="title"><center>"._ESOLUTIONNOTSUBSCRIBED."</font></center><br><br>';

    But if you need " and ' in the text then use the heredoc method...

    $nrsubscribed.= <<< END_SOME_MARKER
    <font class="title"><center>"._ESOLUTIONNOTSUBSCRIBED."</font></center><br><br>

    LVL 40

    Expert Comment

    The END_SOME_MARKER can be anything sensible. I have always used END_xxxx where xxxx is the type of text (HTML, CSS, JS, SQL) or the closing tag if a complicated tag (END_HTML_OPTION, END_HTML_SELECT, etc).

    You cannot embed function calls or constants in this way unfortunately. You will need to create normal variables for them.

    Also, the HTML is way bad!!! Opening and closing tags out of sequence...

    Try ...

    $nrsubscribed.= <<< END_SOME_MARKER
    <font class="title"><center>$_ESOLUTIONNOTSUBSCRIBED</center></font><br /><br />


    $nrsubscribed.= "<font class=\"title\"><center>" . _ESOLUTIONNOTSUBSCRIBED . "</center></font><br /><br />"'

    LVL 40

    Expert Comment

    Oops. Typo...

    $nrsubscribed.= "<font class=\"title\"><center>" . _ESOLUTIONNOTSUBSCRIBED . "</center></font><br /><br />";

    ; and not ' on the end of the line.
    LVL 1

    Author Comment

    I think you was more or less on track, so ill give the points

    Thanks for your time :)
    LVL 40

    Expert Comment

    What do you mean? More or less!? (<grin />)


    The TString the error is referring to is the word 'title'

    After the opening " for class= (which is actually interpreted as the closing "), the next thing would be either a . to append more text or a ; to terminate the statement.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now