Swoole\Timer::info
Get information about a timer.
Description
Get information about a timer. As of Swoole 4.4.0.
Parameters
timer_idThe timer ID returned by
Swoole\Timer::tickorSwoole\Timer::after.
Return Values
Returns an array describing the timer, or null if no timer with this ID exists in the current process. The array contains the following keys:
exec_msecThe time of the next execution, in milliseconds, counted from the moment the timer subsystem was started. It is not a duration.
exec_countThe number of times the callback has been executed. Available as of Swoole 4.8.0.
intervalThe interval of the timer, in milliseconds.
roundThe number of the timer loop round in which the timer was created.
removedWhether the timer has been removed.
Examples
Swoole\Timer::info() example
<?php
$timer_id = Swoole\Timer::tick(1000, function () {});
var_dump(Swoole\Timer::info($timer_id));
Swoole\Timer::clear($timer_id);
?>The above example will output something similar to:
array(5) {
["exec_msec"]=>
int(1000)
["exec_count"]=>
int(0)
["interval"]=>
int(1000)
["round"]=>
int(0)
["removed"]=>
bool(false)
}