OpenSwoole\Timer::clearAll

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\Timer::clearAll()\:\ bool

Parameters

none

Return

success

if success, it returns true

fail

if it fails false will be returned

Description

Clear all the current timers within the same process space.

Basically the same as OpenSwoole\Timer::clear but it clears all active timers at once.

OpenSwoole >= v4.4.0 is required

Example

<?php

OpenSwoole\Timer::tick(3000, function () {
    echo "after 3000ms.\n";
});

$str = "OpenSwoole";
OpenSwoole\Timer::after(5000, function() use ($str) {
    echo "Hello, $str\n";
});

// Stop all timers
OpenSwoole\Timer::clearAll();
Last updated on September 1, 2022