<?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/>";
}
}
|