Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 22.x
Latest version:
pecl install openswoole-22.1.2
<?php Swoole\Timer::clearAll()\:\ bool
if success, it returns true
if it fails false
will be returned
Clear all the current timers within the same process space.
Basically the same as Swoole\Timer::clear
but it clears all active timers at once.
Swoole >= v4.4.0 is required
<?php
Swoole\Timer::tick(3000, function () {
echo "after 3000ms.\n";
});
$str = "Swoole";
Swoole\Timer::after(5000, function() use ($str) {
echo "Hello, $str\n";
});
// Stop all timers
Swoole\Timer::clearAll();