stream_context_get_options()
stream_context_get_options() — Retrieve options for a stream/wrapper/context.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
Signature
stream_context_get_options(resource $stream_or_context): array
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $stream_or_context | resource | The stream or context to get options from |
Return value
Returns an associative array with the options.
Example
A runnable snippet:
$params = array("method" => "POST"); stream_context_set_default(array("http" => $params)); var_dump(stream_context_get_options(stream_context_get_default()));
Output:
array(1) { ["http"]=> array(1) { ["method"]=> string(4) "POST" } }
All PHP 8.5 built-in functions
Reference card built from the PHP manual page stream_context_get_options() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.