Tracking the script execution time in PHP

Hi there guys! Today I am going to share a very useful snippet that you can use to see the execution time of your script while debugging your script.

Tracking the script execution time in PHP is very easy with below simple steps:

First you have to define variables at the start and at the ends and call the microtime() function at start and end and store the time in those variables.

After that you will need to subtract the end variable from the start variable (micro time) and that’s it. Below is the simple example.


mixed microtime ([ bool $get_as_float = false ] ) — Return current Unix timestamp with microseconds

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments Protection Status
Would love your thoughts, please comment.x