<?php
/***
Author: Alexis López (@AlexisThrasher)
*/
$string = "<script>alert('Hello World!')</script>";
echo "Bad string: " . $string . "\n";
echo "Sanitized with strip_tags(): " . strip_tags($string) . "\n"; echo "Sanitized with RegEx: " . preg_replace('/<(.*)?>(.*)?(<(.*)?>)?/s', '', $string);
PD9waHAKLyoqKgoJQXV0aG9yOiBBbGV4aXMgTMOzcGV6IChAQWxleGlzVGhyYXNoZXIpCiovCgokc3RyaW5nID0gIjxzY3JpcHQ+YWxlcnQoJ0hlbGxvIFdvcmxkIScpPC9zY3JpcHQ+IjsKZWNobyAiQmFkIHN0cmluZzogIiAuICRzdHJpbmcgLiAiXG4iOwplY2hvICJTYW5pdGl6ZWQgd2l0aCBzdHJpcF90YWdzKCk6ICIgLiBzdHJpcF90YWdzKCRzdHJpbmcpIC4gIlxuIjsKZWNobyAiU2FuaXRpemVkIHdpdGggUmVnRXg6ICIgLiBwcmVnX3JlcGxhY2UoJy88KC4qKT8+KC4qKT8oPCguKik/Pik/L3MnLCAnJywgJHN0cmluZyk7