In this tutorial learn how to Removes slashes contained in a string using function with stripslashes() method.
Tutorial
Tutorial
<?php
/**
* Strip Slashes
*
* Removes slashes contained in a string
*
* @param mixed string
* @return mixed string
*/
function strip_slashes($str)
{
if ( ! is_array($str))
{
return stripslashes($str);
}
foreach ($str as $key => $val)
{
$str[$key] = strip_slashes($val);
}
return $str;
}
echo strip_slashes("f\\'oo b\\'ar");
?>
Above Tutorial Output: f'oo b'ar
No comments:
Post a Comment