How to combine an XML declaration (prolog) with PHP?
An XML declaration should be part of a valid XHTML page, even though it’s not mandatory.
The problem arises the moment we want to use this declaration at the beginning of a PHP script. Both the XML declaration and the PHP code use < > brackets. PHP tries to chew through the declaration code here, but unsuccessfully - the script stops on the first possible line.
How do we work around this limitation and have an XML declaration in any PHP script? Just use echo with single quotes:
echo '<?xml version="1.0" encoding="utf-8"?>';