Swoole\Timer::list

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

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));
}
Last updated on August 31, 2022