Posted by J.O. Aho on 04/07/07 15:56
MS wrote:
> Im sure this must be quite easy to accomplish but I can not find the
> function/way to do it.
>
> MySQL Database field is saved as....
>
> "this is the text
>
> and has line breaks
>
> like this"
>
> Now I want to concat each line into a variable like this.
>
> "this is the text and has line breaks like this"
>
> I have tried trim() which supposedly takes out whitespace but its not
> working as I expect.
trim removes whitespace before the first none-whitespace character in a
string, and all the whitespace after the last none-whitespace character in the
same string.
if you trim this string " a z ", you get "a z", you can have what ever kind
of whitespace charactes between a and z without them being removed.
> What do I have to do?
In this case eregi_replace could work, replace "\n" with a " " and you should
get one line. http://www.php.net/manual/en/function.eregi-replace.php
--
//Aho
[Back to original message]
|