PHP Script Timer
Timer class defenition
This a simple PHP class to test the speed of my scripts, it can be embedded into any PHP script to measure the execution time of a selected piece of code. It is deliberately very simple to prevent any significant increase in execution time.
Using the timer
Using the class is very simple, as it only has three very small functions.
- Create an instance of timer
- At the beginning of your script, call the start() function.
- now the time is running, the code you want to measure comes next.
- At the end of your script, call the stop() function
- The running time is now stared in the timer object, you can call get_result() at any time to find out the time logged.