phpday 2027 - Call for Papers

StreamPollHandle::isValid

(PHP 8 >= 8.6.0)

StreamPollHandle::isValid — Checks whether the stream is open and not at end-of-file

Açıklama

public function StreamPollHandle::isValid(): bool

Checks whether the stream of the handle is still open and has not reached its end.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Returns true if the stream is open and not at end-of-file, false otherwise.

Örnekler

Örnek 1 StreamPollHandle::isValid() example

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

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

// The other end is closed, so the stream reaches its end.
fclose($writer);
var_dump($handle->isValid());

fclose($reader);
var_dump($handle->isValid());

Yukarıdaki örneğin çıktısı:

bool(true)
bool(false)
bool(false)

Ayrıca Bakınız

  • Io\Poll\Watcher::isActive()
  • feof() - Bir dosya tanıtıcısı üzerinde konum dosya sonunda mı diye bakar
+add a note

User Contributed Notes

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