Re: print <<TXT in PHP, like in Perl?

From: Date: Fri, 31 Mar 2000 18:19:38 +0000
Subject: Re: print <<TXT in PHP, like in Perl?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-17477@lists.php.net to get a copy of this message
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@php.net> Netmill iTech| |http://www.coastnet.com/~torben http://www.netmill.fi| |Ph: 1 250 383-9735 torben@netmill.fi| +----------------------------------------------------------------+

« previous php.dev (#17477) next »