newline and return issues in string

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

 



I have come across an issue with my string that I would like to find a
faster way to resolve.

It seems there are new lines and returns at different positions of the
string. 

 

First I exploded on the new line explode(?\n?, $ string)

This gave me a nice array but when I try to implode I get the new lines
again.

There is not a consistent position and there seems to be some hidden returns
in the array as well.

 

Is there a way, or has someone written a filter that would allow me to
remove all the newlines and returns from the array or string.

Understand I have resolved this issue but I think I have to be going about
this the hard way because it is just too complex .

 

FYI

$filter = array("\r\n", "\n", "\r");

str_replace($filter,??,$string) ß this is useless in this situation I have
tried and it does not change the string at all.

Understand the newlines and returns do not display in the string as
literals. Meaning you do not see /n or /r it is hidden.

 

 


[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