stream_filter_remove()
stream_filter_remove() — Remove a filter from a stream.
Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.1.0, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Removes a stream filter previously added to a stream with stream_filter_prepend() or stream_filter_append(). Any data remaining in the filter's internal buffer will be flushed through to the next filter before removing it.
Signature
stream_filter_remove(resource $stream_filter): bool
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $stream_filter | resource | The stream filter to be removed. |
Return value
Returns true on success or false on failure.
Example
A runnable snippet:
/* Open a test file for reading and writing */ $fp = fopen("test.txt", "rw"); $rot13_filter = stream_filter_append($fp, "string.rot13", STREAM_FILTER_WRITE); fwrite($fp, "This is "); stream_filter_remove($rot13_filter); fwrite($fp, "a test\n"); rewind($fp); fpassthru($fp); fclose($fp);
Output:
Guvf vf a test
See also
stream_filter_register(), stream_filter_append(), stream_filter_prepend()
All PHP 8.5 built-in functions
Reference card built from the PHP manual page stream_filter_remove() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.