Swoole\Timer::list

Declaration

<?php
Swoole\Timer::list()\:\ Swoole\Timer\Iterator

Parameters

none

Return

Swoole\Timer\Iterator

A iterator which can be used within a foreach loop to process the active timers for the current worker process

Description

List all the timers within the current worker process, a Swoole\Timer\Iterator is returned which you can use within a foreach loop to process all the active timers.

Swoole >= v4.4.0 is required

Example

<?php

// Show information for currently active timers
foreach (Swoole\Timer::list() as $timerId)
{
    var_dump(Swoole\Timer::info($timerId));
}