Login   Register  
PHP Classes
elePHPant
Icontem

File: timer.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 6 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/>";
    }
}