Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return true if the given function has been defined
<?php function_exists(string $function): bool
<?php public function __construct()
{
if (!\function_exists('event_base_new')) {
throw new BadMethodCallException('Cannot create ExtLibeventLoop, ext-libevent extension missing');
}
<?php public function __construct()
{
if (!\function_exists('uv_loop_new')) {
throw new \BadMethodCallException('Cannot create LibUvLoop, ext-uv extension missing');
}
<?php private static function construct()
{
if (\function_exists('uv_loop_new')) {
return new ExtUvLoop();
}
<?php return new ExtEventLoop();
}
if (\function_exists('event_base_new') && \PHP_MAJOR_VERSION === 5) {
return new ExtLibeventLoop();
}
<?php {
$this->futureTickQueue = new FutureTickQueue();
$this->timers = new Timers();
$this->pcntl = \function_exists('pcntl_signal') && \function_exists('pcntl_signal_dispatch');
$this->pcntlPoll = $this->pcntl && !\function_exists('pcntl_async_signals');
$this->signals = new SignalsHandler();
<?php $this->futureTickQueue = new FutureTickQueue();
$this->timers = new Timers();
$this->pcntl = \function_exists('pcntl_signal') && \function_exists('pcntl_signal_dispatch');
$this->pcntlPoll = $this->pcntl && !\function_exists('pcntl_async_signals');
$this->signals = new SignalsHandler();
<?php public function __construct()
{
$this->useHighResolution = \function_exists('hrtime');
}
public function updateTime()
<?php $sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);
foreach ($sockets as $socket) {
if (function_exists('stream_set_read_buffer')) {
stream_set_read_buffer($socket, 0);
}
}
<?php public function testSignal()
{
if (!function_exists('posix_kill') || !function_exists('posix_getpid')) {
$this->markTestSkipped('Signal test skipped because functions "posix_kill" and "posix_getpid" are missing.');
}
<?php $this->markTestSkipped('libevent tests skipped on linux due to linux epoll issues.');
}
if (!function_exists('event_base_new')) {
$this->markTestSkipped('libevent tests skipped because ext-libevent is not installed.');
}
<?php {
public function createLoop()
{
if (!function_exists('uv_loop_new')) {
$this->markTestSkipped('uv tests skipped because ext-uv is not installed.');
}
<?php {
public function createLoop()
{
if (!function_exists('event_base_new')) {
$this->markTestSkipped('libevent tests skipped because ext-libevent is not installed.');
}
<?php {
public function createLoop()
{
if (!function_exists('uv_loop_new')) {
$this->markTestSkipped('uv tests skipped because ext-uv is not installed.');
}