<?php 
function phps($var){
    $var = trim($var);
    $var = stripslashes($var);
    $var = strip_tags($var);
    $var = htmlspecialchars($var);
    $var = str_replace("&amp;","&",$var);

    return $var;

}
?>