stream_get_meta_data
Function • Params and return types changed in PHP 8.0
Retrieves header/meta data from streams/file pointers.
stream_get_meta_data Function synopsis
stream_get_meta_data($stream): array
Parameters
$stream
The stream can be any stream created by fopen,
fsockopen pfsockopen and stream_socket_client.
Return value
Typearray
The result array contains the following items:
`timed_out` (bool) - `true` if the stream
timed out while waiting for data on the last call to
[`fread`](/codex/fread) or [`fgets`](/codex/fgets).
`blocked` (bool) - `true` if the stream is
in blocking IO mode. See [`stream_set_blocking`](/codex/stream_set_blocking).
`eof` (bool) - `true` if the stream has reached
end-of-file. Note that for socket streams this member can be `true`
even when `unread_bytes` is non-zero. To
determine if there is more data to be read, use
[`feof`](/codex/feof) instead of reading this item.
`unread_bytes` (int) - the number of bytes
currently contained in the PHP's own internal buffer.
`stream_type` (string) - a label describing
the underlying implementation of the stream.
`wrapper_type` (string) - a label describing
the protocol wrapper implementation layered over the stream.
See for more information about wrappers.
`wrapper_data` (mixed) - wrapper specific
data attached to this stream. See for
more information about wrappers and their wrapper data.
`mode` (string) - the type of access required for
this stream (see Table 1 of the fopen() reference)
`seekable` (bool) - whether the current stream can
be seeked.
`uri` (string) - the URI/filename associated with this
stream.
`crypto` (array) - the TLS connection metadata for this
stream. (Note: Only provided when the resource's stream uses TLS.) Changes to the stream_get_meta_data Function
PHP 8.0
- Return type added:
array - Parameter name of parameter #1 changed:
$fpto$stream
- stream_get_meta_data($fp)
+ stream_get_meta_data($stream): array stream_get_meta_data Function Availability
stream_get_meta_data Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |