Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
<?php OpenSwoole\Server->clearTimer(int $timerId): bool
The timer ID that you want to clear/destroy, you can get the timer ID from the return after starting one
If success, it returns true
, otherwise it returns false
.
Cancel the timer and destroy it immediately. Alias of function OpenSwoole\Timer::clear
.
The timer must be active within the current process.
<?php
$timer_id = $server->tick(1000, function ($id) use ($server)
{
$server->clearTimer($id);
});