php8.5
Home/ Manual/ stream / functions/ stream_context_get_options

stream_context_get_options

PHP function Edit on GitHub ✎

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

Retrieve options for a stream/wrapper/context

Description

stream_context_get_options(resource $stream_or_context): array

Returns an array of options on the specified stream or context.

Parameters

stream_or_context

The stream or context to get options from

Return Values

Returns an associative array with the options.

Examples

stream_context_get_options() example

php
<?php
$params = array("method" => "POST");

stream_context_set_default(array("http" => $params));

var_dump(stream_context_get_options(stream_context_get_default()));

?>

The above example will output something similar to:

output
array(1) {
  ["http"]=>
  array(1) {
    ["method"]=>
    string(4) "POST"
  }
}

Source: reference/stream/functions/stream-context-get-options.xml · from the official PHP manual (php/doc-en)