Re: xml v php question
| From: | David Tulloh | Date: | Tue, 25 Jul 2006 13:33:56 +0000 |
| Subject: | Re: xml v php question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239766@lists.php.net to get a copy of this message | ||
Larry Garfield wrote:
> Disable short tags.
>
> If short tags are enabled, the PHP parser sees the <? and switches into PHP
> mode. It then starts parsing the "xml" and sees that it's not proper PHP,
> and freaks out.
>
> You can:
>
> a) Use PHP to print out the XML declaration as a string:
> <?php print '<?xml version="1.0" encoding="utf-8"?>';
> ?>
>
> b) Disable short tags so that the PHP parser ignores <? and only recognizes
> <?php.
>
> The correct answer is (b). (PHP 6 won't even have short tags, so get used to
> not having them.)
>
Can you find anywhere where this was announced? I don't recall seeing
any decision on it.
A quick search found several mentions of the devs deciding to keep short
tags when going from php 4 to php 5. The php 6 todo list shows that <%
will be removed but <? will stay.