Alix Axel
Alix Axel

Reputation: 154663

In PHP, what is a Tick?

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

Answers (4)

pavium
pavium

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

Nujra
Nujra

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

Ignas R
Ignas R

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

Chris Kloberdanz
Chris Kloberdanz

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

Related Questions