Swoole\Timer->clear

Declaration

<?php
Swoole\Timer->clear (int $timer_id)

Parameters

timer_id

Timer ID

Return

success

if success, it returns TRUE, otherwise it returns FALSE.

Description

Clear a Timer by Timer ID.

Example

<?php
$count = 0;
function run($timerid, $param)
{
    global $count;
    $count++;
    var_dump($count);
    if($count >= 10)
    {
        Swoole\Timer->clear($timerid);
    }
}

Swoole\Timer->tick(1000, "run",["param1", "param2"]);