Is there a specific PHP function or method that can be used to replace non-visible characters in a string?

To replace non-visible characters in a string in PHP, you can use the `preg_replace` function with a regular expression pattern that matches non-printable characters. The regular expression pattern `'/[^\p{L}\p{N}\s]/u'` can be used to match any characters that are not letters, numbers, or whitespace. You can then use `preg_replace` to replace these characters with an empty string.

```php
$string = "Hello\nWorld\t!";
$clean_string = preg_replace('/[^\p{L}\p{N}\s]/u', '', $string);
echo $clean_string;
```

This code snippet will output: `Hello World!`, with the non-visible characters (newline and tab) removed from the original string.