Reputation: 154663
I know that Ticks are not PHP specific and are somewhat related to timing and/or number of operations, but I lack all the understanding that would otherwise allow me to work with them.
Can someone please explain to me what ticks are / do in a simple fashion?
Upvotes: 24
Views: 10534
Reputation: 15128
This link (found via Google) says that Ticks are
a underused and powerful feature of PHP that allows you to implement exceptions in PHP4
But you're probably not talking about PHP4, in which case, go with the other answers.
Upvotes: 2
Reputation: 1
Ticks have been deprecated as of PHP 5.3, and will be removed entirely at some point in the future. ... Put simply, a tick is a special event that occurs internally in PHP each time it has executed a certain number of statements. These statements are internal to PHP and loosely correspond to the statements in your script.
Upvotes: -2
Reputation: 3409
In PHP, a tick is like an event which is triggered after every n-th statement (the n is declared using declare
), with a few exceptions such as control structures (if
, for
, ...). It is possible to register a tick handler, which would be called every tick. This is a very rarely used feature, but sometimes it may be helpful, for example, for simple profiling.
Upvotes: 15
Reputation: 4546
I found a decent explanation here. I have used them in writing daemons.
I think declare() might be planned for deprecation. I know it was at one point.
EDIT: It was the ticks directive that was planned for deprecation.
Upvotes: 16