Re: Quotes in Heredoc

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

 



On Sat, 2011-02-26 at 14:41 +0530, Ashim Kapoor wrote:

> Dear All,
> 
> I am learning PHP by reading a book. My query pertains to the following
> lines : -
> 
> $form_str = <<< EOFORMSTR
> <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 ALIGN=CENTER
> WIDTH=621>
> <TR>
> <TD ROWSPAN=2><IMG WIDTH=15 HEIGHT=1
> SRC=../images/spacer.gif></TD>
> 
> 
> .....
> 
> My query is that is it true that we don't need to do
> <TABLE ... ALIGN="CENTER" ...>
> 
> ie. we don't need to quote the value of the options in Heredoc. Is that
> correct?
> 
> Many thanks,
> Ashim.


The quotes you mention are in the HTML, nothing to do with PHP. HTML
will work without the quotes in most cases (unless there's a space in
the value for the attribute) but the quotes are required in XHTML and
will cause unexpected results.

The only difference Heredoc makes in PHP is that the strings you write
don't require characters to be escaped, which you would have to do
normally in traditional quoted strings.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux