<?php
function strip_html_tags( $text )
{
$text = preg_replace(
array(
// Remove invisible content
'@<head[^>]*?>.*?</head>@siu',
'@<style[^>]*?>.*?</style>@siu',
'@<script[^>]*?.*?</script>@siu',
'@<object[^>]*?.*?</object>@siu',
'@<embed[^>]*?.*?</embed>@siu',
'@<applet[^>]*?.*?</applet>@siu',
'@<noframes[^>]*?.*?</noframes>@siu',
'@<noscript[^>]*?.*?</noscript>@siu',
'@<noembed[^>]*?.*?</noembed>@siu'
),
array(
'', '', '', '', '', '', '', '', ''), $text );
return strip_tags( $text);
}
function make_safe($variable) {
$variable = strip_html_tags($variable);
$bad = array("=","<", ">", "/","\"","`","~","'","$","%","#");
$variable = str_replace($bad, "", $variable);
$variable = (trim($variable));
$variable = str_replace(' ','',$variable);
echo $variable;
}
make_safe("<strong>Test-A bsatz. </strong>");
?>
preferences:
40.39 ms | 402 KiB | 5 Q