Re: Tick callbacks

From: Date: Fri, 01 Sep 2000 16:26:47 +0000
Subject: Re: Tick callbacks
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-31599@lists.php.net to get a copy of this message
That's pretty neat to see ticks finally realizing :) As out tick functionality is something with a very high WTF rating, we should document that it should only be used in fairly rare cases, and only by advanced users. Zeev On Fri, 1 Sep 2000, Andrei Zmievski wrote: > 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. > > -- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.dev (#31599) next »