Gossamer Forum
Home : General : Chit Chat :

qq~

Quote Reply
qq~
I have, for years, used Perl for all my web development and have starting tinkering with PHP.

If I want to assign a large text block to a variable is there a qq~ equivalent in PHP as there is in Perl?

Example:

$textblock = qq~ Line 1
...
Line 12
...
~;

Can that, and if so, how is that, done in PHP?
Quote Reply
Re: [Lee] qq~ In reply to
$text = <<<HTML
Line 1
...
Line 12
...

HTML;


will work if you want to assign text to a string variable without escaping special / reserved characters.

----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [Lee] qq~ In reply to
If you use the method Dan provided (be *sure* that the end WORD; part is totally over to the left of the page. If it isn't, you will get a parse error).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!