PHP Classes

File: example.php

Recommend this page to a friend!
  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: 18 years ago
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==1 || $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');



?>