If you know the precise subset of characters you wish to allow (as you seem to do) then you are probably better doing this with a regex:
$str = 'String to sanitize';
$str = preg_replace('/[^A-Za-z0-9~!@#$%^&*()=_+{}[\]:";\'<>,.\/? \t-]/','',$str);
(Disclaimer: I think I've escaped the necessary characters in the regex, but need to test!)
The regex consists of one big
negated (^ prefix) character class containing the chars you wish to allow. Any chars not belonging to this class are replaced with an empty string.
The hyphen (-) is placed at the end of the char class to remove its special meaning and match a literal hyphen.
\] - The closing square bracket is escaped to match a literal square bracket
\' - The apostrophe/single quote is escaped since I've used single quoted strings in PHP.
\/ - the slash is escaped since that is our regex delimiter.
\t - tab
Note that this regex omits the blackslash (\) and pipe (|) characters (omitted from your list of chars).