Question: i have a sms script with php code where i have recived sms through sms portal. but in some message i have got \r and \n but on sms portal no special character like \r \n found 

My message is like - NOKXX REG WMAH12345

but i have got this - NOKXX REG WMAH12345\r
 NOKXX REG WMAH12345\n
 NOKXX REG WMAH12345\n\n
 NOKXX REG\RWMAH35907

i have got message from get method.............

```
$message = $_GET['message'];// Message content

```

i have tried this

```
$message=str_replace("\r\n","",$message);

```

and this as well

```
$message = trim($message);
// from everywhere
$message = str_replace("\n", "", $message);
$message = str_replace("\r", "", $message);

```

please suggest some alternate

Answer: 
Use single quotes, if your `\r` and `\n`'s are being treated as strings, so:

```
$message = str_replace(array('\n', '\r'), array('', ''), $message);

```

currently, your `str_replace` will look for actual line-breaks, not the string `\r` and `\n`.
try this...order is also imp

```
// Order of replacement
$str     = "Line 1\nLine 2\rLine 3\r\nLine 4\n";
$order   = array("\r\n", "\n", "\r");
$replace = '';

// Processes \r\n's first so they aren't converted twice.
$newstr = str_replace($order, $replace, $str);

```