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
Using a heredoc in PHP as in Perl [message #171885] Thu, 20 January 2011 09:00 Go to previous message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma:
Member
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
[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: Sun Nov 24 15:03:16 GMT 2024

Total time taken to generate the page: 0.04286 seconds