Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 22.x
Latest version:
pecl install openswoole-22.1.2
<?php Swoole\Timer::exists(int $timerId)\:\ bool
The Timer ID you want to check if it exists
if success, it returns TRUE, otherwise it returns FALSE.
Check if a timer still exists by using the Timer ID.
<?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';
}