Swoole\Timer->after

Declaration

<?php
Swoole\Timer->after (int $interval_ms, callable $callback [, string[] $callback_params ])

Parameters

interval_ms

Milliseconds interval duration

callback

Callback function

callback_params

The parameters passed into the callback function

Return

success

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

Description

Schedule a one-time callback function in the future after $interval_ms ms.

Callback function

<?php
function($param) {

}

Example

<?php
function run($param)
{
    var_dump(func_get_args());
    var_dump($param);
}

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