PHP Classes

setTimeout and setInterval: Call a function after a period of time

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 61%Total: 1,647 All time: 2,379 This week: 381Up
Version License PHP version Categories
callback_timers 0.5MIT/X Consortium ...5.0PHP 5, Time and Date, Language


This class can be used to make PHP call a function after a period of time.

It can register one or more callback functions that should be called after a given timeout value or every time after a given period of time elapses.

The class registers a single callback function to handle PHP tick calls. That function takes care of calling all registered timer callback functions.

Innovation Award
PHP Programming Innovation award nominee
August 2009
Number 7

Prize: One downloadable e-book of choice by O'Reilly
Some applications have scripts that need to execute tasks that take a long time to execute.

In some cases, it is convenient to execute code periodically during the execution of such long tasks, like for instance to update information about the tasks' progress.

This class provides a generic solution for regularly calling application defined code during the execution of a long task.

Manuel Lemos
Picture of Sam S
Name: Sam S <contact>
Classes: 9 packages by
Country: United States United States
Age: 48
All time rank: 34340 in United States United States
Week rank: 389 Down44 in United States United States Down
Innovation award
Innovation award
Nominee: 8x

  Files folder image Files  
File Role Description
Accessible without login Plain text file Timers.class.php Class The class and function definition file
Accessible without login Plain text file Timers_test.php Example An example of how the timers are implemented and used.
Accessible without login Plain text file Timers_test2.php Example An additional portion of the example
Accessible without login Plain text file Timers_test3.php Example An additional portion of the example

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:2,379
This week:381Up
User Ratings User Comments (1)
 All time
ok, thats a very good class .
14 years ago (Josť Filipe Lopes Santos)