register_tick_function
PHP Manual
PHP Manual»Function handling Функції»register_tick_function

register_tick_function

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

register_tick_function — Register a function for execution on each tick

Опис

function register_tick_function(callable $callback, mixed ...$args): bool

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

Параметри

callback

The function to register.

args

Значення, що повертаються

Повертає true у разі успіху або false в разі помилки.

Журнал змін

Версія Опис
8.5.0 Tick handlers are now deactivated later during request shutdown: after all shutdown functions and destructors have run, and after the output handlers have been cleaned up. Previously they were deactivated at the very beginning of request shutdown, so tick functions were no longer called during shutdown functions, destructors, or output handling. See the migration guide for details.

Приклади

Приклад #1 register_tick_function() example

<?php
declare(ticks=1);

function my_tick_function($param) {
    echo "Tick callback function called with param: $param\n";
}

register_tick_function('my_tick_function', true);
?>

Прогляньте також

To Top