[thelist] \r\n and single quotes in php

Kelly Hallman khallman at wrack.org
Sat Mar 8 16:08:01 CST 2003


Dunstan,

Check out the heredoc syntax on this page:
http://www.php.net/manual/en/language.types.string.php
Note the warning that the closing identifier cannot be delimited.
This caused me some grief recently.

Your other options are to end with '<htmlcode"">'."\r\n\r\n" or you could
define a function, constant or other variable that evaluates to \r\n\r\n
and concatenate that onto the end, which might make things more readable.

or you could actually do this:
$footer_paging = '<div class="tone2" style="padding: 5px; border-top:
1px solid #aaa; font-size: 80%;">\r\n' . $paging . '</div>

';

--Kelly

On Sat, 8 Mar 2003, Dunstan Orchard wrote:
> Is there any way I can retain the use of my single quotes, but still get
> \r\n to work in php? For example, in the code below the \r\n are
> rendered onto the page. If I replace my ' with " then they work
> properly, but then I have to escape all the other double quotes in the
> code (something I'm keen to avoid):
>
> $footer_paging = '<div class="tone2" style="padding: 5px; border-top:
> 1px solid #aaa; font-size: 80%;">\r\n' . $paging . '</div>\r\n\r\n';

--
Kelly Hallman
http://wrack.org/




More information about the thelist mailing list