This is a handy little snippet of code for any one that is trying to optimize there code. I just used this in my Addressbook to see how the pages were loading.
microtime — Return current Unix timestamp with microseconds
There isn’t much to this script, we are going to assign $time-start with a value (start time). Then we would place your code you want to time next. Once the script has executed we then assign a value to $time-end. Simple math will tell us that subtracting $time-start from $time-end will give us the difference, Thus your execution time.
$time-start = microtime(true); // Code Here $time-end = microtime(true); $time = $time_end - $time_start; echo "Loaded in $time seconds\n";
[...] is a handy little Snippet that goes well with PHP Microtime. Not only are we concerned with our scripts execution time but we also want to make sure we are not [...]
February 10, 2009