Thursday, 4 December 2014

How to find execution time for a script in PHP

if your are a PHP dev and you execute php scripts to test time taken, the following code can help you

microtime — Return current Unix timestamp with microseconds

//Start time
$time_start = microtime(true);

// Sleep for 1 sec

//Execution of your script

//End time
$time_end = microtime(true);

//Time taken
$time = $time_end - $time_start;

echo "Time taken is $time seconds\n";


Hope this will be useful in your application


  1. Hello Admin, thank you for enlightening us with your knowledge sharing. PHP has become an inevitable part of web development, and with proper PHP Training in Chennai, one can have a strong career in the web development field. We from Fita provide PHP course in Chennai with the best facilitation. Any aspiring students can join us for the best Best PHP training in chennai

  2. It really useful to me to find execution time in PHP.
    JAVA Training in Chennai|Java Courses in Chennai

  3. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    PHP Training in Chennai | PHP Course in Chennai

  4. I was working on the responsive design and this article provided me the lot of information about designing of website. Using this information i can create the look and feel websites.
    PHP Training in Chennai | PHP Course in Chennai

  5. This very technical information by Admin Thanks for Share the post
    PHP Training in Gurgaon | PHP Training Institute in gurgaon