Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
<?php OpenSwoole\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 OpenSwoole\Timer::clear
but it clears all active timers at once.
OpenSwoole >= v4.4.0 is required
<?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();