most of CMS like joomla , wordpress had good hand input filtering . you can use it directly . it come with lots of extension which help you website development -
Rasi
Jan 6 '17 04:39
function sanitize ($input){
return htmlspecialchars($input,ENT_QUOTES);
}
echo sanitize ("<script >alert('hello');</scrip>")