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.)

On Monday 24 July 2006 20:42, tedd wrote:
> Hi gang:
>
> Why does starting my php script with --
>
> <?xml version="1.0" encoding="utf-8"?>
>
> -- stop it from running?
>
> I would like to use php in a page, but the page has to begin with a
> xml declaration to generate a quirksmode for IE6 and under while
> permitting IE7 to be left in standards mode.
>
> We've tried it in both Wordpress and Textpattern and both are php and
> neither are able to parse a document with an xml declaration above
> the header.
>
> Is this problem solvable?  I've been told that better minds have
> already tried and failed to resolve this issue.
>
> So, what say you group?
>
> Thanks in advance for any replies, comments, explanations, or solutions.
>
> tedd
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to