phpday 2027 - Call for Papers

StreamPollHandle::getStream

(PHP 8 >= 8.6.0)

StreamPollHandle::getStream — Returns the stream of the handle

Опис

public function StreamPollHandle::getStream(): resource

Returns the stream that was passed to StreamPollHandle::__construct().

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns the stream resource. If the stream was closed in the meantime, the returned value is a closed resource.

Приклади

Приклад #1 StreamPollHandle::getStream() example

<?php
[$reader, $writer] = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);

$handle = new StreamPollHandle($reader);
var_dump($handle->getStream() === $reader);

fclose($reader);
var_dump(is_resource($handle->getStream()));

Поданий вище приклад виведе:

bool(true)
bool(false)

Прогляньте також

+add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top