What is stream and stream wrapper in php

For my understanding of threads in PHP, a thread is an interface that provides methods for
reading and writing to the resource, and this interface is implemented in different ways types of stream wrappers (http, ftp, file, etc.) to provide certain functionality. Therefore, when we say that fopen () opens a stream, does this mean the creation of a specific stream is a wrapping object? Please clarify me if I am wrong. Thanks

+6
source share
1 answer

Not all streams are implemented at this level, most of the built-in modules are at C level, so no, because PHP is not a streamwrapper object. This interface ensures that it works as a stream, and not vice versa. (Essentially: all streaming parties can be accessed as a stream resource, but not all stream resources are provided by streamwrapper classes). However, you can override, for example, the file:/// packaging and other built-in functions, great fun.

+8
source

Source: https://habr.com/ru/post/919129/


All Articles