PHP/fx/stream notification callback: Difference between revisions

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< PHP | fx
Created page with "{{fmt/title|PHP function: <code>stream_notification_callback()</code>}} ==Links== ===Official=== * php.net: [https://www.php.net/manual/en/function.stream-notification-callbac..."
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{fmt/title|PHP function: <code>stream_notification_callback()</code>}}
{{page/PHP/fx}}
==About==
This is the prototype for a callback function. A user-function using this same format will be called when any of several different events occur on a stream.
 
The user's function can be activated as a stream's callback by first creating a context that uses it:
$ctx = stream_context_create();
[[../stream_context_set_params/]]($ctx, array("notification" => "stream_notification_callback"));
...and then opening the stream using that context.
 
'''However''': [https://www.php.net/manual/en/function.stream-context-set-params.php this page] mentions casually in passing that it is "Only supported for http:// and ftp:// stream wrappers.", wtf.
==Links==
==Links==
===Official===
===Official===
* php.net: [https://www.php.net/manual/en/function.stream-notification-callback.php stream_notification_callback()]
* php.net: [https://www.php.net/manual/en/function.stream-notification-callback.php stream_notification_callback()]

Latest revision as of 22:49, 10 February 2026

{{#set:language=PHP}}{{#set:page type=library function}}{{#set:function name=stream_notification_callback}}

PHP function: stream_notification_callback()

{{#set: page title=PHP function: stream_notification_callback() }}

About

This is the prototype for a callback function. A user-function using this same format will be called when any of several different events occur on a stream.

The user's function can be activated as a stream's callback by first creating a context that uses it:

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

...and then opening the stream using that context.

However: this page mentions casually in passing that it is "Only supported for http:// and ftp:// stream wrappers.", wtf.

Official