The XML declaration does not need to be handled specially.
You should output it via an echo statement, in case your code is ever used on a server that is (poorly) configured to use short open tags.
But there's no need to treat the ?> at the end of the string specially. That's because it's in a string. The only thing PHP ever looks for in a string is \ or $ (the latter only in double-quoted strings.)
I have never had need for the following, as some have suggested below:
<?php
$xml=rawurldecode('%3C%3Fxml%20version%3D%221.0%22%3F%3E');
echo($xml);
?>
<?php echo '<?xml version="1.0" ?'.'>' ?>
<?php echo "<?xml version=\"1.0\"\x3F>" ?>