PHP Function Reference

PHP stream_context_set_option() Function



The PHP stream_context_set_option() function is used to set an option for the specified stream/wrapper/context. In first version of the function, value is set to option for specified wrapper. In second version of the function, options must be an associative array of associative arrays in the format $arr['wrapper']['option'] = $value.

Syntax

//version 1
stream_context_set_option(stream_or_context, wrapper, option, value)

//version 2
stream_context_set_option(stream_or_context, options)

Parameters

stream_or_context Required. Specify the stream or context resource to apply the options to.
wrapper Required. Specify the name of the wrapper.
option Required. Specify the name of the option.
value Required. Specify the value of the option.
options Required. Specify options to set for stream_or_context. It must be an associative array of associative arrays in the format $arr['wrapper']['option'] = $value.

Return Value

Returns true on success or false on failure.


❮ PHP Streams Reference