$str = removeLast3char($str); function removeLast3char($string){ return trim(substr($string, 0, -3)); }