PHP Classes

File: example-cli.php

Recommend this page to a friend!
  Classes of Dmitry Pljonkin   DM Perfomance Meter   example-cli.php   Download  
File: example-cli.php
Role: Example script
Content type: text/plain
Description: Simple example script (for running in command line mode)
Class: DM Perfomance Meter
Measures script execution time (with checkpoints)
Author: By
Last change:
Date: 18 years ago
Size: 637 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."\n";

$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."\n";

$Timer->checkPoint('2nd check');
$Timer->stop();
$Timer->showResults();
$Timer->logResults('timer.csv');


?>