Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Dmitry Pljonkin  >  DM Perfomance Meter  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Simple example script
Class: DM Perfomance Meter
Measures script execution time (with checkpoints)
Author: By
Last change:
Date: 2005-10-26 08:44
Size: 656 bytes
 

Contents

Class file image Download
<?php

/*
 * Example:
 *
 */

require_once("class.DM_PerfomanceMeter.php");

// init timer
$Timer = new Dm_PerfomanceMeter;

// start!
$Timer->start();

// do some stuff:
$total 1;
for (
$i=1$i<=50$i++) {
    
$total *= $i;
}
echo 
$total."<br>";

$Timer->checkPoint('1st check');

function 
factorial($num)
{
     if (
$num==|| $num==0) {
          return 
1;
     }
     elseif (
$num>1) {
          return 
factorial($num-1)*$num;
     }
}
$total factorial(50);
echo 
$total."<br>";

$Timer->checkPoint('2nd check');
$Timer->stop();
$Timer->showResults('html_ul');
$Timer->showResults('html_comment');



?>