StartTime = microtime(); return true; } function Get_Time ($text="", $decimals=2) { // $decimals will set the number of decimals you want for your milliseconds. // format start time $start_time = explode (" ", $this->StartTime); $start_time = $start_time[1] + $start_time[0]; // get and format end time $end_time = explode (" ", microtime()); $end_time = $end_time[1] + $end_time[0]; $this->StartTime = microtime(); printf ("%s: %s
",$text,number_format ($end_time - $start_time, $decimals)); } } /* // You can use: define ("TIMER_START_TIME", microtime()); // in your program config file (or somewhere it will always get set), or you can use this explicitly where you want to start the timer: Script_Timer::Start_Timer(); // A constant definition is used so the starting time can be retrieved from anywhere. // When you want to retrieve the time difference (from start to finish) use: $total_time = Script_Timer::Get_Time(3); */ ?>