note 37415 rejected from language.basic-syntax by didou
| From: | didou@php.net | Date: | Tue, 16 Dec 2003 09:38:56 +0000 |
| Subject: | note 37415 rejected from language.basic-syntax by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62037@lists.php.net to get a copy of this message | ||
Note Submitter: zipdragon7@yahoo.com
----
mrtidy at mail dot com said:
I am moving my site to XHTML and I ran into trouble with the <?xml ?> interfering with the
<?php ?> method of escaping for HTML. A quick check of the mailing list confirmed that the
current preferred method to cleanly output the <?xml ?> line is to echo it:<br>
<?php echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
?>
--end--
I had the worst time escaping double quotes due to the need of double quotes in almost everything
else.
So I've swiched to using single quotes as much as possible in PHP and use double quotes only
when needed.
So my way of kicking out the XML declaration for any XML-based document (yes this means XHTML too)
would be as follows:
<?php
echo('<?xml version="1.0"
encoding="utf-8"?>'."\n");
?>
But honestly I like the idea of the first note, where you can just hack away at code like it
doesn't cause any problems and just close it out before you exit your script.
<?php
echo >>>EOD
etc...
EOD;
?>
However I wonder if it should be "END" and not "EOD" per the example in the
documentation under "echo"?
Either way, if it works as he said, I'm going that route if it is easier.
Cheers.