RE: Echo Syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>I wonder if this gives you the ability to use double-quotes and single-quotes
>in the same block, without having to use the escape character ('\') to escape
>a double quote?

         Yes it does. The structure is called "here document" and 
it's very useful.

>It would give you variable translations and double-quotes at the same time,
>with very little effort.'

         Absolutely, it is also very easy to modify.

         I use the structure to accumulate text and do only one IO.

$HTML.=<<<HTML
this is text one
this is line two
HTML;

$HTML.=<<<HTML
this is text two
HTML;

echo $HTML;

Be careful of a couple of things. Neither the opening or closing 
labels can have
and trailing spaces.
The closing label must start in column 1.
There is no automatic "\n" following the line above the closing 
label. Either put in
a \n or put in an empty line.

Urb



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux