Strip Function, Not Stripping Everything?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adamjblakey
    New Member
    • Jan 2008
    • 133

    Strip Function, Not Stripping Everything?

    Hi,

    I have the following function which does not strip everything i need.

    [PHP]
    function StripAll($value ) {

    $value = preg_replace('/[\r\n\t]+/', '', $value);
    $value = preg_replace("/[rn]+[st]*[rn]+/","n",$valu e);
    $value = stripslashes($v alue);
    $value = mysql_real_esca pe_string($valu e);
    $value = trim($value);
    $value = strip_tags($val ue);
    $value = str_replace("," , "", $value);
    $value = str_replace("." , "", $value);
    $value = str_replace("'" , "", $value);
    $value = str_replace(";" , "", $value);
    $value = str_replace("&" , " ", $value);
    $value = str_replace("(" , "", $value);
    $value = str_replace(")" , "", $value);

    return $value;

    }
    [/PHP]

    This still leaves in rn , full stops and brackets any ideas what is wrong with the function?

    Cheers,
    Adam
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    No idea, but replace lines 9-xx with this one[php]$value = str_replace(arr ay(",", ".", ";","&", "(", ")", "\r", "\n", "[", "]"), "", $value);[/php]Ronald

    Comment

    Working...