Regular expressions? What's that?

Posted by Stanislav Furman  on April 29, 2014

Apparently, the person who wrote this code has never heard about regular expressions. :)

<?php
$find = str_replace(",", "", $find);
$find = str_replace(".", "", $find);
$find = str_replace("/", "", $find);
$find = str_replace(" ", "", $find);
$find = str_replace("-", "", $find);
$find = str_replace("+", "", $find);
$find = str_replace("#", "", $find);
?>

Please, never repeat this! :)


Comments

nightbloos says:
May 19, 2014 at 12:12 pm
Once i see more funny code, something like this

$forReplace = array(",",
".",
" ",
"-",
"+",
"#"
"/");
foreach($forReplace as $repl){
$find = str_replace($repl,'',$find)
}

Flag as SPAM  |  Permalink
Stanislav Furman says:
May 19, 2014 at 02:09 pm
Ahahahaha! Yeah, it's a good one too! :)
Flag as SPAM  |  Permalink

Leave your comment

Fields with * are required.

* When you submit a comment, you agree with Terms and Conditions of Use.