Go Back   Gaming Gutter > Non-Gaming > Programming > Tutorials


Tutorials - Looking for programming tutorials to increase your knowledge? Do so here.

» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post learning noob vs. Kyo:...
Yesterday 05:26 PM
Last post by cookieface
Today 06:39 AM
60 Replies, 426 Views
Go to first new post Random Accounts
Yesterday 01:08 PM
by Tyler
Last post by Tyler
Today 06:36 AM
3 Replies, 18 Views
Go to first new post What button do you think...
Today 04:45 AM
by Googlrr
Last post by Tyler
Today 06:34 AM
3 Replies, 15 Views
Go to first new post Good AB list for newbies
09-03-2008 08:28 PM
Last post by Lanbo
Today 06:31 AM
7 Replies, 363 Views
Go to first new post [PHP] Myspace FLP
08-18-2008 11:05 AM
by |G3|
Last post by |G3|
Today 06:16 AM
3 Replies, 114 Views
Reply
 
LinkBack Thread Tools Display Modes

 Creating a PHP Script Timer
Old 10-18-2006, 03:43 PM   #1 (permalink)
Oosband
Guest

 
Posts: n/a
iTrader: / %
Creating a PHP Script Timer

This timer is easy to implement and determines the time taken for a php script to execute correct to a microsecond.

Insert this code at the top of the page:
Code:
<?php 
	  $mtime = microtime(); 
	  $mtime = explode(' ', $mtime); 
	  $mtime = $mtime[1] + $mtime[0]; 
	  $starttime = $mtime; 
?>
Then at the bottom of the page add the following:
Code:
<?php 
	  $mtime = microtime(); 
	  $mtime = explode(" ", $mtime); 
	  $mtime = $mtime[1] + $mtime[0]; 
	  $endtime = $mtime; 
	  $totaltime = ($endtime - $starttime); 
	  echo 'This page was created in ' .$totaltime. ' seconds.'; 
?>
PHP's microtime() function returns the current Unix timestamp with microseconds.
  Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Short URL Script (PHP + HTML) Oosband Tutorials 6 11-17-2006 05:27 PM

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -7. The time now is 06:41 AM.


vBulletin skin developed by: eXtremepixels
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.11842704 seconds (100.00% PHP - 0% MySQL) with 20 queries