Function handling 函数
在线手册:中文  英文

unregister_tick_function

(PHP 4 >= 4.0.3, PHP 5)

unregister_tick_functionDe-register a function for execution on each tick

说明

void unregister_tick_function ( string $function_name )

De-registers the function named by function_name so it is no longer executed when a tick is called.

参数

function_name

The function name, as a string.

返回值

没有返回值。

参见


Function handling 函数
在线手册:中文  英文

用户评论:

Greg (2012-07-27 00:02:11)

It's not so clear, but, at least as of PHP 5.3.13, you cannot use this inside of the handler itself as it will throw an error:

<?php

declare(ticks=2);

function 
tick_handler()
{
    
unregister_tick_function('tick_handler');
}

register_tick_function('tick_handler');

set_time_limit(0);
usleep(500000);

?>

results in:

warning: unregister_tick_function(): Unable to delete tick function executed at the moment in [filename]

So if you want to unregister it must be done outside of the handler.

rob dot eyre at gmail dot com (2011-07-22 05:22:06)

Note that unregister_tick_function() can also accept a callback in the form of an array (either static, like array($className, $methodName) or instance, like array(&$this, $methodName)).
It cannot accept an anonymous function, however.

易百教程