# PHP Annoyance



## Moose (Sep 1, 2008)

<?PHP
$thing="<a href="www.google.com">Google</a>";
?>

<html>
<body>

<?PHP
print $thing;
?>

</body>
</html>

How come with the above code I get this error message: PHP Parse error: syntax error, unexpected T_STRING in D:\inetpub\Moose\test.php on line 2

<?PHP
$thing="<u>Google</u>";
?>

<html>
<body>

<?PHP
print $thing;
?>

</body>
</html>

Whereas with this code everything is fine? Both are inserting html but the <a> set doesn't work but <u> does. Any suggestions on how to insert a link or why this has happened?


----------



## W1zzard (Sep 1, 2008)

you close the string too early. as soon as a " sign is encountered php thinks the string ended.
use \" when using double quotes to escape the " sign


----------



## Moose (Sep 1, 2008)

Cheers I didn't think


----------

