Re: Outputting text "<?" how to?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux