PHP Function Reference

PHP stream_context_get_options() Function



The PHP stream_context_get_options() function returns an array of options on the specified stream or context.

Syntax

stream_context_get_options(stream_or_context)

Parameters

stream_or_context Required. Specify the stream or context to get options from.

Return Value

Returns an associative array with the options.

Example: stream_context_get_options() example

The example below shows the usage of stream_context_get_options() function.

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

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

var_dump(stream_context_get_options(stream_context_get_default()));
?>

The output of the above code will be:

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

❮ PHP Streams Reference