How to measure query execution time
Posted: Fri Aug 29, 2008 10:51 am
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.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
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";
?>