<?php
/*
* Example to show how to time a section of code.
*
* Paul Gregg <pgregg@pgregg.com>
* 7 August 2003
* Qube @ Efnet #php
*
*/

Function StartTimer() {
  global 
$search_starttime;
  
$search_starttime microtime(true);
}

Function 
FinishTimer() {
  global 
$search_endtime;
  
$search_endtime microtime(true);
}


Function 
DifferenceTimer() {
  global 
$search_starttime;
  global 
$search_endtime;

  
$tot_secs sprintf("%0.6f"$search_endtime-$search_starttime);
  return 
$tot_secs;
}

StartTimer();
// Do something here
FinishTimer();
echo 
'Code took 'DifferenceTimer(), ' seconds.';

?>