Re: Carriage returns



On Wed, 21 Jun 2006 08:15:50 -0700, Dan Pearce wrote:
$search = array ('\n\n');

I have also tried \n, \r, \n\r etc... in place of \n\n but to no avail.

Two things:

1) I'd try "\r\n\r\n", Windows users (which I'd imagine your
no-computer-knowledge people are) using notepad inserts \r\n for a
carriage return.

2) Use double quotes instead of single quotes. Try the following script
using PHP CLI:

<?php
print "Two blanks lines with double quotes:";
print "\n\n";
print "Two blanks lines with single quotes:";
print '\n\n';
?>

$ php test2.php
Two blanks lines with double quotes:

Two blanks lines with single quotes:\n\n

\n's aren't interpreted within single quotes, so it searches for the
literal string slash-n not a newline char.

Can anyone help me with this?

I hope the above helps. In future though, rather than guessing at line
endings using a hex editor may help ;-)

Cheers,


Andy


--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

.



Relevant Pages

  • Re: nesting JS in echos
    ... converted from html to php. ... syntax of the single quotes and double quotes needed in the ...
    (comp.lang.php)
  • Re: Proper Way to Use [while] Loops
    ... I'm new to PHP and am trying to create a template from the ... set up a loop to post every item on the newspost table. ... // START MARKUP ... Using double quotes in a string enclosed with single quotes requires no escaping and vica versa. ...
    (alt.php)
  • Re: print variable inside function
    ... Single quotes work just fine in HTML and has definite advantages over using double quotes, ... The specs say to use " in HTML, and its no problem to do from PHP wothout creating a mess. ...
    (comp.lang.php)
  • Re: [PHP] Optimized PHP
    ... quotes "s where needed as they are parsed by PHP and instead use single ... echo 'This is some text'. ... by PHP looking for variables or other escaped characters. ... In an application where I am having some different settings for each of the ...
    (php.general)
  • RE: [PHP] Cannot send a hyperlink
    ... Yes you do not need quotes in the mailfunction. ... [PHP] Cannot send a hyperlink ... Your problem is the Headers are missing which allows the html content to ...
    (php.general)