Swoole\Timer::exists

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\Timer::exists(int $timerId)\:\ bool

Parameters

timerId

The Timer ID you want to check if it exists

Return

success

if success, it returns TRUE, otherwise it returns FALSE.

Description

Check if a timer still exists by using the Timer ID.

Example

<?php

function run($timerId, $param1, $param2) {
    var_dump($timerId);
    var_dump($param);
}

$timerId = Swoole\Timer::tick(1000, "run", ["param1", "param2"]);

if(Swoole\Timer::exists(timerId))
{
  echo 'Yes timer does exist';
}
else
{
  echo 'No, timer does not exist';
}
Last updated on August 31, 2022