Re: Stripping carriage returns

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

 



On Tue, Jan 11, 2011 at 11:13 AM, Richard S. Crawford <richard@xxxxxxxxxxxxx
> wrote:

> $content = preg_replace("/[".chr(10)."|".chr(13)."]/","",$content)
>

This should be

    $content = preg_replace('/[\r\n]/','',$content)

First, you can embed \r and \n directly in the regular expression as-is (not
converted to chr(10) by PHP) by using single quotes. Second, you don't want
the vertical bar inside []. That's only for ().

David

[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