Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/gree

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Reeder

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/gree

    Cant seem to find the culprit line :(

    Heres the code:

    Code:
    <?
    
    echo"
    
    <center>
    
    <!-- AMAZON CODE STARTS HERE -->
    
    <SCRIPT charset="utf-8" type="text/javascript" src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822/US/aerocom05-20/8002/ab0febc9-fc42-435e-bae7-18b3dd299162"> </SCRIPT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Faerocom05-20%2F8002%2Fab0febc9-fc42-435e-bae7-18b3dd299162&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT>
    
    <!-- AMAZON CODE ENDS HERE -->
    
    </center>
    
    ";
    
    ?>
    Last edited by Atli; Oct 17 '10, 12:55 PM. Reason: Please use [code] tags when posting code.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    You can not use double-quotes inside a double-quoted string. The first double-quote following the opening quote will be read as the closing quote, which means that anything that follows is read as PHP code, thus causing errors if it doesn't happen to be valid PHP.

    [code=php]
    <?php
    # INVALID! Causes a parse error.
    $str = "He said: "Hello, World!"";

    # VALID! Escaping the quote with a \ allows you
    # to put double-quotes into a double-quoted string.
    # Same goes for single-quoted strings.
    $str = "He said: \"Hello, World!\"";

    # Also VALID. You can put double-quotes into
    # single-quoted strings, and vice versa.
    $str = 'He said: "Hello, World!"';
    ?>
    [/code]

    Comment

    Working...