I have a php script which starts with the following line
<?xml version="1.0" encoding="UTF-8"?>
It works fine in the LAMP world but when I port it to Windows I think it thinks this line is code when it's not as I get this error in Visual Studio:
Syntax error: unexpected token 'version'
Is there a way that I can get Windows php to not consider this to be code? I thought all code blocks had to start with <?php
?
You can just use the header function of PHP to render this tag for you. Put this at the very first line of your code:
<? header("Content-type: text/xml; charset=utf-8") ?>
Then you won't have problems with the opening PHP tag.