Removing a line wrap
Date: 11/07/07
(PHP Community) Keywords: no keywords
I'm stuck trying to remove a line wraps from a string:
$str = "
`val_div_phe_value`,
`val_div_phe_status`,
`met_div_phe_value`,
`met_div_phe_status`
";
So I tried this:
$str = str_replace('\r', '', str_replace('\n', '', $str));
No luck.
Any ideas?
Answer
Digitalsidhe noticed that I was using single quotes. To look for and replace special characters like \n double quotes must be used.
$str = str_replace("\r", '', str_replace("\n", '', $str));
Source: http://community.livejournal.com/php/594835.html