OpenSwoole\Timer::exists

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\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 = OpenSwoole\Timer::tick(1000, "run", ["param1", "param2"]);

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