FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Using a heredoc in PHP as in Perl
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Using a heredoc in PHP as in Perl [message #171887 is a reply to message #171885] Thu, 20 January 2011 09:16 Go to previous messageGo to previous message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma:
Senior Member
On 20-01-11 10:00, P E Schoen wrote:
> I am going to be using PHP to perform an HTML purification before the
> user's input from a form is presented to a Perl script which saves the
> content and presents it in HTML format. I am totally new to PHP and I
> have just a basic working knowledge of Perl. In Perl, I use a heredoc
> which is done with a statement such as:
>
> print <<"END";
> My Text...
> END
>
> I found several references such as http://en.wikipedia.org/wiki/Heredoc
> to a similar means for PHP, but it did not work for me (parse error on
> line with the <<<):
>
> echo <<<EOF
> My Text...
> EOF;
>
> I am actually using this to create HTML, and I found that it can be
> simply written in the PHP document outside the <?php and ?> tags. But I
> would also like to be able to use a heredoc to print to a file, and I
> don't know if that is possible in PHP. If so, I'd appreciate any ideas
> on how to do it. TIA.
>
> Paul
>
>

The best syntax of a heredoc in PHP is found on the site with the docs
http://www.php.net

for 'heredoc' this is:
http://nl3.php.net/manual/en/language.types.string.php#language.types.strin g.syntax.heredoc

--
Luuk
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Placing an URL in email
Next Topic: HOW TO MAKE MONEY ONLINE? MOST RICH PEOPLE ACHIEVE FROM FOREX
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 17:27:40 GMT 2024

Total time taken to generate the page: 0.05759 seconds