Example 1 — Read Params From a Plain Context
Create a context with HTTP options only, then list the keys returned by get_params().
<?php
$ctx = stream_context_create([
"http" => ["method" => "GET"],
]);
$params = stream_context_get_params($ctx);
echo implode(",", array_keys($params)), PHP_EOL;
echo $params["options"]["http"]["method"], PHP_EOL; How It Works
- The context is created with one HTTP option and no special parameters.
- get_params() still returns an array.
- The only top-level key here is options.
- We print the nested HTTP method from that options section.

