Solved

Test execution time of script

Posted on 2009-05-18
1
514 Views
Last Modified: 2012-05-07
Hi E's,
What is the code for test the execution of scripts.
This is useful for me, because I have a script that check connections, and I want check the time between star and end of the script.

Regards, JC
0
Comment
Question by:Pedro Chagas
1 Comment
 
LVL 5

Accepted Solution

by:
bored321 earned 500 total points
ID: 24416863
This is what i use.
<!-- put this at the top of the page -->

<?php

   $mtime = microtime();

   $mtime = explode(" ",$mtime);

   $mtime = $mtime[1] + $mtime[0];

   $starttime = $mtime;

;?>
 

<!-- put other code and html in here -->
 
 

<!-- put this code at the bottom of the page -->

<?php

   $mtime = microtime();

   $mtime = explode(" ",$mtime);

   $mtime = $mtime[1] + $mtime[0];

   $endtime = $mtime;

   $totaltime = ($endtime - $starttime);

   echo "This page was created in ".$totaltime." seconds";

;?>

Open in new window

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now