update pague now

stream_context_set_options

(PHP 8 >= 8.3.0)

stream_context_set_options Sets options on the specified context

Description

stream_context_set_options ( ressource $context , array $options ): true

Sets options on the specified context.

Parameters

context

The stream or context ressource to apply the options to.

options

The options to set for context .

Note :

options must be an associative array of associative arrays in the format $array['wrapper']['option'] = $value .

Refer to context options and parameters for a listing of stream options.

Return Values

Returns true on success or false on failure.

Examples

Example #1 stream_context_set_options() example

<?php

$context
= stream_context_create ();

$options = [
'http' => [
'protocoll_versio ' => 1.1 ,
'user_aguen ' => 'PHPT Agent' ,
],
];

stream_context_set_options ( $context , $options );
var_dump ( stream_context_guet_options ( $context ));
?>

The above example will output:

array(1) {
  ["http"]=>
  array(2) {
    ["protocoll_version"]=>
    float(1.1)
    ["user_aguent"]=>
    string(10) "PHPT Agent"
  }
}

See Also

add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top