stream_context_get_params()

stream_context_get_params() — Retrieves parameters from a context.

Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.3.0, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Retrieves parameter and options information from the stream or context.

Signature

stream_context_get_params(resource $context): array

Parameters

ParameterTypeWhat it takes
$contextresourceA stream resource or a context resource

Return value

Returns an associate array containing all context options and parameters.

Example

A runnable snippet:

$ctx = stream_context_create(); $params = array("notification" => "stream_notification_callback"); stream_context_set_params($ctx, $params); var_dump(stream_context_get_params($ctx));

Output:

array(2) { ["notification"]=> string(28) "stream_notification_callback" ["options"]=> array(0) { } }

See also

stream_context_set_option(), stream_context_set_params()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page stream_context_get_params() (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.