Login   Register  
PHP Classes
elePHPant
Icontem

File: example1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Joshua Townsend  >  Code Timer  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: Example of using class to see how long a function takes to execute
Class: Code Timer
Measure the time a PHP script takes to execute
Author: By
Last change:
Date: 7 years ago
Size: 433 bytes
 

Contents

Class file image Download
<?php
require "timer.class.php"// Get the timer class

// Simplest way to use this class:

$timer = new timer(); // Create an object; automatically starts timer unless called as timer(false)
$contents file_get_contents("http://www.example.com"); // Example of code that might take a while to execute
$time $timer->stop(); // Stop the timer and get the execution time

echo "Contents retrieved in {$time} seconds.";
?>