PHP/resource/stream

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Revision as of 17:44, 10 February 2026 by Woozle (talk | contribs)
stream-type "resource" demiobjects in PHP

{{#set: page title=stream-type "resource" demiobjects in PHP }}

About

Although there are a lot of functions that handle streams in PHP, how to properly use these functions is often not explained very well. I'm having to reverse-engineer a lot through trial and error.

Tentative Conclusions

  • If a stream is set to blocking mode (with stream_set_blocking(<stream resource>, TRUE);), then EoS (end-of-stream) is indicated by the return of an empty string.
    • Questions about how it works in non-blocking mode:
      • How do we detect EoS in non-blocking mode?
      • Does empty-string still correctly signal that the process has completed?
      • What happens if the process has not completed (so there's no new data yet) -- how can we tell that there might be more?

Official