Strip slashes from array elements

Views: 14 Last modified: September 17th, 2011 Comments: 0

This recursive function will strip slashes from each array element. It works fine with multidimensional arrays. Might become handy for $_POST or $_GET or whatever you need it.

function StripArraySlashes($arr)
{
    foreach ($arr as $k => $v)
        $ReturnArray[$k] = (is_array($v)) ? StripArraySlashes($v) : stripslashes($v);
    return $ReturnArray;
}
VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)
    Bluehost

    Mail this!

    To: From:Sum {5+8} =  
    Anything to add ?

        You must be logged in to post a comment.