Tick callbacks
| From: | Andrei Zmievski | Date: | Fri, 01 Sep 2000 16:13:11 +0000 |
| Subject: | Tick callbacks | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-31596@lists.php.net to get a copy of this message | ||
I've just added support for userland PHP tick callback functions. This
can be used to simulate background processing. Usage example:
<?
function foo($a)
{
print "$a\n";
}
function zoo()
{
static $i = 0;
print "I am: $i\n";
$i++;
}
register_tick_function("foo", "I'm here!");
register_tick_function("zoo");
declare (ticks = 3)
{
1;1;
1;1;
1;1;
}
?>
This would output:
I'm here!
I am: 0
I'm here!
I am: 1
It's also possible to use array($obj, 'method') syntax for callbacks,
and there is unregister_tick_function() as well.
-Andrei
Nobody tried to design Windows - it just grew in random
directions without any kind of thought behind it.