PHP.nl

stream_filter_prepend

stream_filter_prepend

Attach a filter to a stream

resource **stream_filter_prepend** resource $stream string $filter_name int $mode mixed $params

Adds to the list of filters attached to . filter_name``stream

streamThe target stream.

filter_nameThe filter name.

mode By default, will attach the filter to the if the file was opened for reading (i.e. File Mode: , and/or ). The filter will also be attached to the if the file was opened for writing (i.e. File Mode: , , and/or ). , , and/or can also be passed to the parameter to override this behavior. See for an example of using this parameter. stream_filter_prepend``read filter chain``r``+``write filter chain``w``a``+``STREAM_FILTER_READ``STREAM_FILTER_WRITE``STREAM_FILTER_ALL``mode``stream_filter_append

params This filter will be added with the specified to the of the list and will therefore be called first during stream operations. To add a filter to the end of the list, use . paramsbeginningstream_filter_append

Returns a resource on success or false on failure. The resource can be used to refer to this filter instance during a call to . stream_filter_remove

false is returned if is not a resource or if cannot be located. stream``filter_name

Opmerking: > ### When using custom (user) filters

 must be called first
in order to register the desired user filter to .

stream_filter_register``filter_name

Opmerking: > Stream data is read from resources (both local and remote) in chunks, with any unconsumed data kept in internal buffers. When a new filter is prepended to a stream, data in the internal buffers, which has already been processed through other filters will be reprocessed through the new filter at that time. This differs from the behavior of . notstream_filter_append

Opmerking: > When a filter is added for read and write, two instances of the filter are created. must be called twice with and to get both filter resources. stream_filter_prepend``STREAM_FILTER_READ``STREAM_FILTER_WRITE

stream_filter_register``stream_filter_append