note 37415 added to language.basic-syntax

From: Date: Fri, 14 Nov 2003 08:34:48 +0000
Subject: note 37415 added to language.basic-syntax
Groups: php.notes 
Request: Send a blank email to php-notes+get-60369@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/language.basic-syntax.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37415 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37415&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37415&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#60369) next »