Is it possible to determine the status of a file descriptor in PHP?

I have a file descriptor (edit: resource returned by fopen on a stream that is not necessarily a local file) that is being blackboxed. When it pops up, is it possible to determine with any certainty if the handle has been closed?

Edit:

It looks like the get_resource_type ($ fd) function will return "Unknown" on a private resource. Does anyone know if this is true for most PHP versions?

+2


source to share


2 answers


Use the fstat () function



+4


source


I don't think it is the right thing to do this transfer of the file pointer to the black box without knowing if it is closed or not. This seems to break consistency. Could you explain why you need this? Perhaps we could suggest a better solution.



0


source







All Articles