Re: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in

From: Date: Fri, 26 May 2006 04:07:54 +0000
Subject: Re: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-236926@lists.php.net to get a copy of this message
Mark Sargent wrote:
Hi All, I get the error for line 15 for this code, <?php
    15 echo "<font face='"$_SESSION['font']"'";
    16 echo " size='"$_SESSION['size']"'";
    17 echo " color='"$_SESSION['colour']"'>";
    18 echo "$_SESSION['text']";
    19 echo "</font>";
    20 ?>
I have put ' ' quotes around the " " quotes for each font attribute so that the parser doesn't think the echo is finished too early. Is that wrong? I know that this code would get tedious for lots of text and CSS would be better, but, it's just a little study project from the book I'm following. Cheers. Mark Sargent. any of these will work:
echo "<font face='".$_SESSION['font']."'"; //note the . before and after the variable. echo "<font face='{$_SESSION['font']}'"; echo "<font face='$_SESSION[font]'";//no quotes around the index key ryan

« previous php.general (#236926) next »