PHP Classes

File: timer.php

Recommend this page to a friend!
  Classes of Andrey Nikishaev   Little Timer   timer.php   Download  
File: timer.php
Role: Class source
Content type: text/plain
Description: class
Class: Little Timer
Measure the time a script takes to execute
Author: By
Last change: add some
Date: 15 years ago
Size: 329 bytes
 

Contents

Class file image Download
<?php
class Timer {
    static
$time=array();
    public function
set($n='0') {
        list(
$msec, $sec) = explode(chr(32), microtime());
       
self::$time[$n]=$msec+$sec;
    }
    public function
get($n='0') {
        list(
$msec, $sec) = explode(chr(32), microtime());
       
$now=$msec+$sec;
        return
round($now-self::$time[$n], 12)."<br/>";
    }
}