You could replace if by ASCII code (^M is actually a representation of ASCII
013, the CR character, thanks to for the ASCII
lookup table.).

This should fix it (untested)


$chrnumber = 13; //this is the ascii code for ^M

$nicestring = str_replace(chr($chrnumber),"(removed M was



where $nicestring is the output,
$chrnumber contains the ascii code for ^M,
and the input (original) string is $badstring. Dynamic data driven web solutions
----- Original Message -----
From: "Michael Hall" <[EMAIL PROTECTED]>
Sent: June 08 2002 05:40 PM
Subject: [PHP] Removing ^M

> I am trying remove ^M characters (some kind of newline character) from an
> HTML file. I've tried all sorts of ereg_replace and sed possibilities
> but the
> things just won't go away. Does anyone have a way of removing such
> characters?
> Mick
> --
> PHP General Mailing List (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to