You can specify what tags to allow and this will strip all other tags
$value = strip_tags($variable,"<a><font><u><b><i><img>");
The html tags I specified are the exception to stripping tags, those listed will be permitted to be used and all others will strip from display / rendering.
Next, the following checks if magic_quotes_gpc is on. This setting in the php.ini file adds backslashes before all double / single quotes in your database input.
if (!get_magic_quotes_gpc()) {
$str = addslashes($content);
} else {
$str = $content;
}