Example 1 — Store a Notification Callback Name
Attach a notification parameter and print it with get_params().
<?php
$ctx = stream_context_create();
stream_context_set_params($ctx, [
"notification" => "stream_notification_callback",
]);
$params = stream_context_get_params($ctx);
echo $params["notification"], PHP_EOL; How It Works
- An empty context is created.
- set_params() stores the notification entry.
- get_params() returns the stored parameters.
- We print the callback name string.

