Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’

I echo the following:

echo "<a id="example2" href=".$arResult['DETAIL_PICTURE']['SRC']." width=".$arResult['DETAIL_PICTURE']['WIDTH']." height=".$arResult['DETAIL_PICTURE']['HEIGHT']."><img src=".$arResult['DETAIL_PICTURE']['SRC']." width=200 border=0 alt=".$arElement['NAME']." title=".$arElement['NAME']." /></a>";

Please tell me where I messed up with the syntax.

Answer 1

Try escaping the quotes of the id attribute.

echo "<a id=\"\"></a>";

Answer 2

Just take a look at the code highlighting and you will immediately see that example2 is recognized as T_STRING. The quotes are closed after id=.

Leave a reply

Please enter your comment!
Please enter your name here