Thursday, January 10, 2013

Time me

Here's a quick tidbit to time something in PHP pretty accurately. Jotted down here for future posterity.




$mtime = explode(" ", microtime());
$starttime = $mtime[1] + $mtime[0];

// something worth timing...


$mtime = explode(" ", microtime());
$endtime = $mtime[1] + $mtime[0];
$totaltime = ($endtime - $starttime);


I didn't write it, and can't recall where I found it. But it works well. Enjoy.

2 comments:

  1. There is definately a lot to know about this issue. I love all of the points you made.

    ReplyDelete
  2. For latest information you have to pay a quick visit the web and on the web I found this web site as a most excellent web site for newest updates.

    ReplyDelete