带有XML的PHP​​行会导致意外的“>”错误

When I set variables that include angle brackets (< >) or slashes I keep getting errors like the following (code simplified to focus on error):

Parse error: syntax error, unexpected '>' in D:\hosting\8499439\html\test.php on line 2

<?php
   $xml = “<Request>
”;
?>

I also run into a lot off issues with "unexpected T_String" errors that appear to be related.

I'm running PHP5 on a GoDaddy Windows Server.

What am I doing wrong? (I get the impression I need to to do something so that special characters can be handled in my PHP).

Thanks in advance.

Your quotes are curly quotes, not straight quotes, so PHP runs into an error processing them. A string can only be recognized with straight quotes.

Use the following code:

<?php
   $xml = "<Request>
";
?>

Assuming that you have the same error elsewhere, you can probably do a simple search-and-replace to fix the error: search for one of the curly quotes, replace with a straight quote. Repeat with the other curly quote. Make sure to check for straight quotes that may need to be escaped (for instance, something like "Mary said, "I like this."" would need to be escaped as "Mary said, \"I like this.\"")

mc10 is right. Additionally I can say, there are only ""(double) and ''(single) quotes in PHP. I suggest you to read about differences between them. I prefer using single quotes only to keep code clear.