register_tick_function

(PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8)

register_tick_functionRegister a function for execution on each tick

说明

register_tick_function ( callable $function , mixed $arg = ? , mixed $... = ? ) : bool

Registers the given function to be executed when a tick is called.

参数

function

The function name as a string, or an array consisting of an object and a method.

arg

...

返回值

成功时返回 true, 或者在失败时返回 false

范例

示例 #1 register_tick_function() example

<?php
declare(ticks=1);

// using a function as the callback
register_tick_function('my_function'true);

// using an object->method
$object = new my_class();
register_tick_function(array(&$object'my_method'), true);
?>

更新日志

版本 说明
5.3.0 Ticks are now supported on threaded web server modules.

注释

警告

register_tick_function() should not be used with threaded web server modules with PHP 5.2 or lower.

参见