public static function digits($value) { // we need to remove - and + because they're allowed in the filter $cleaned = str_replace(array('-', '+'), '', $value); $cleaned = filter_var($cleaned, FILTER_SANITIZE_NUMBER_INT); return $cleaned; }