stream_filter_register

PHP 5, PHP 7, PHP 8
stream_filter_register - Register a user defined stream filter
Manual
Code Examples

stream_filter_register( string$filter_name, string$class ): bool

stream_filter_register allows you to implement your own filter on any registered stream used with all the other filesystem functions (such as fopen, fread etc.).

Parameters

filter_name

The filter name to be registered.

class

To implement a filter, you need to define a class as an extension of php_user_filter with a number of member functions. When performing read/write operations on the stream to which your filter is attached, PHP will pass the data through your filter (and any other filters attached to that stream) so that the data may be modified as desired. You must implement the methods exactly as described in php_user_filter - doing otherwise will lead to undefined behaviour.

Return Values

Returns true on success or false on failure.

stream_filter_register will return false if the filter_name is already defined.

Related Functions

Example of stream_filter_register

Show all examples for stream_filter_register

PHP Version:


Function stream_filter_register:

Streams Functions

Most used PHP functions