Re: Outputting text "<?" how to?

From: Date: Thu, 30 Mar 2006 14:22:55 +0000
Subject: Re: Outputting text "<?" how to?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-232924@lists.php.net to get a copy of this message
At 11:28 AM +0200 3/30/06, Merlin wrote:
Hi there, I would like to output following text with php: <?xml version="1.0" encoding="ISO-8859-1" ?> How can I do that? I tried to escape the ? with \? but this did not help. Any ideas? Thank you for any hint, Merlin
Merlin: First the syntax should be: <?xml version="1.0" encoding="ISO-8859-1" ?/> <-- note the close / Second, to what do you want to output the text? If you want to write it to a text file, try: $filename = "text.txt"; $file = fopen( $filename, "w" ); fwrite( $file, '<?xml version="1.0" encoding="ISO-8859-1" ?/>'); fclose( $file ); If you want to print it to a web page, try: <?php $a=<<<EOD &lt;?xml version="1.0" encoding="ISO-8859-1" ?/> EOD; echo($a); HTH's tedd PS: I would also consider changing the encoding to utf-8 -- -------------------------------------------------------------------------------- http://sperling.com

« previous php.general (#232924) next »