Found this in the PHP manual:
Note: Also note that if you are embedding PHP within XML or XHTML you will need to use the <?php ?> tags to remain compliant with standards.
What?? Who cares?? I mean, this embedded PHP code is meant to be seen only by the PHP interpreter, parsed and sent back to the client as XML or XHTML, so what’s the point here?
Advertisement
It has nothing to do with PHP. Processing instructions in XML data have to be well formed.
The PHP manual is right to recommend good practices. If you like to valid your XML data when they contain PHP processing instruction.
For the record, PHP allows both “<?" (short tag) and "<?php" as start tag. Short tags should be avoided as there is a risk to mess up either with a validation tool or with the php interpreter when it meets other "<?".
More info about PI:
http://www.w3.org/TR/REC-xml/#sec-pi