remove line breaks

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I've got the following problem:
I'm handling multiple string variables, initialized from a simple text
file read.
At a certain point I need to create the output via a series of echoes,
something like
   echo "The " . $a . " can " . $b ;
The point is that for some reason [which I still haven't really
recognized, often such lines break home in 2 lines, giving me
   The frog
   can jump
instead of
   The frog can jump

Any way to avoid it ?

Re: remove line breaks

Quoted text here. Click to load it

If you are outputting that in the middle of HTML sent to a browser,
realize that HTML ignores newlines and is willing to put line breaks
anywhere it wants to.

If you want that to start at the beginning of a line, preceed it with
HTML like "<br>" or "<p>" (don't copy the quotes literally).
There's also the "<pre> ... text </pre>" for pre-formatted text.

Re: remove line breaks

InuY4sha wrote:

Quoted text here. Click to load it

The error must be in the code you're not showing. No way that echo
statement will produce /n or /r characters.

Re: remove line breaks

InuY4sha escribió:
Quoted text here. Click to load it

When reading the file, append the input to the same variable until you
find a carriage return.

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor al baño María:

Site Timeline