Tuesday, 11 March 2014

PHP stripslashes() Function

Definition and Usage

The stripslashes() function removes backslashes added by the addslashes() function.
Tip: This function can be used to clean up data retrieved from a database or from an HTML form.

<?phpfunction stripslashes_deep($value)
{
    
$value is_array($value) ?
                
array_map('stripslashes_deep'$value) :
                
stripslashes($value);

    return 
$value;
}
// Example$array = array("f\\'oo""b\\'ar", array("fo\\'o""b\\'ar"));$array stripslashes_deep($array);
// Outputprint_r($array);?>

Returns:--

Array
(
    [0] => f'oo
    [1] => b'ar
    [2] => Array
        (
            [0] => fo'o
            [1] => b'ar
        )

)

No comments:

Post a Comment

Thank your for your comment..your submitted coment will be live after admin approval