Re: [PHP-DEV] print <<TXT in PHP, like in Perl? From: Lars Torben Wilson (torben <email protected>)
Date: 03/31/00

Liviu Chiriac writes:
>
> In Perl the following works:
> print <<TXT;
> This is a line
> This is another line
> This is the last line
> TXT;
>
> How do I do this in PHP?
>
> One way is:
> print "
> This is a line
> This is another line
> This is the last line
> ";
>
> I want to print HTML which has quotes in it, so the above is not too
> convenient because I would need to escape every single quote.
>
> Liviu

Check out the here doc:

   http://www.php.net/manual/language.types.string.php

Example:

<?php
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
?>

By the way, this sort of question should really go to the PHP3 users'
mailing list; the PHP-dev list is for people developing PHP, not
people developing _in_ PHP. :)

Cheers,

Torben

-- 
+----------------------------------------------------------------+
|Torben Wilson <torben <email protected>>                     Netmill iTech|
|http://www.coastnet.com/~torben            http://www.netmill.fi|
|Ph: 1 250 383-9735                             torben <email protected>|
+----------------------------------------------------------------+

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>