How to measure query execution time
Moderator: General Moderators
How to measure query execution time
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
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";
?>