That's Perl for $str = preg_replace ("/\r\n/g", "\n", $str);

-------- Original Message --------
Subject: [nyphp-talk] What does this code do?
From: -- rada -- <[EMAIL PROTECTED]>
Date: Mon, March 03, 2008 1:12 pm
To: talk@lists.nyphp.org

Hi all,

I am trying to implement a user-input scrubbing function, more specifically, normalize linebreaks from windows/mac to unix. I can just do preg_replace but I saw this piece of code somewhere and don't understand it enough to even know what to google.

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

What does =~ do? I can RTFM if you point me to it :)



Never miss a thing. Make Yahoo your homepage.
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to