Page 1 of 1

How to measure query execution time

Posted: Fri Aug 29, 2008 10:51 am
by matthijs
How can I get back the query execution time in PHP? I know the command line automatically returns the query time. But I'd like to have the results in my php scripts.

Re: How to measure query execution time

Posted: Fri Aug 29, 2008 12:01 pm
by marcth

Code: Select all

 
<?php
$time_start = microtime(true);
 
// Sleep for a while
usleep(100);
 
$time_end = microtime(true);
$time = $time_end - $time_start;
 
echo "Did nothing in $time seconds\n";
?>