phpday 2027 - Call for Papers

Io\Poll\Backend::isAvailable

(PHP 8 >= 8.6.0)

Io\Poll\Backend::isAvailable — Checks whether the backend is available on the platform

Açıklama

public function Io\Poll\Backend::isAvailable(): bool

Checks whether an Io\Poll\Context can be created with this backend on the current platform.

Bağımsız Değişkenler

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

Dönen Değerler

Returns true if the backend is available, false otherwise. Io\Poll\Backend::Auto is always available.

Örnekler

Örnek 1 Selecting a backend only if it is available

<?php
use Io\Poll\Backend;
use Io\Poll\Context;

$backend = Backend::Kqueue->isAvailable() ? Backend::Kqueue : Backend::Auto;
$context = new Context($backend);

var_dump(Backend::Auto->isAvailable());

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

bool(true)

Ayrıca Bakınız

+add a note

User Contributed Notes

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