I have a code which I开发者_运维百科 extracted from a text file. Every character in the text file have been embedded into array including line breaks. I want to ignore the line breaks. I've tried so many ways but it fails.
Can you help me? :)
If you mean you have an array of lines ending with \n
, you can remove them like so...
$line = rtrim($line, "\n");
Did you try
str_replace("\n", "", $text);
..?
http://ideone.com/rpQCq
精彩评论