NYCPHP Meetup

NYPHP.org

[nycphp-talk] What does this code do?

Steve Manes smanes at magpie.com
Mon Mar 3 14:32:18 EST 2008


-- rada -- wrote:
> 
> supposedly converts Windows CRLF  to Unix LF:
> $str =~ s/\r\n/\n/g;

Perl sed function.

There's no need to use a regex function unless you have a regex pattern 
to match.  If you just need to remove the carriage returns, this will be 
two or three times faster:

$str = str_replace("\r", "", $str);




More information about the talk mailing list