Warning: Closing resources locally, e.g. with fclose, might not invoke the callback. Be sure to cancel the
watcher when closing the resource locally. Drivers MAY choose to notify the user if there are watchers on invalid
resources, but are not required to, due to the high performance impact. Watchers on closed resources are
therefore undefined behavior.
Multiple watchers on the same stream MAY be executed in any order.
public static onReadable ( resource $stream, callable $callback, mixed $data = null ) : string | ||
$stream | resource | The stream to monitor. |
$callback | callable | |
$data | mixed | Arbitrary data given to the callback function as the `$data` parameter. |
return | string | An unique identifier that can be used to cancel, enable or disable the watcher. |