PHP Classes

File: example.php5

Recommend this page to a friend!
  Classes of Kai Dorschner   Benchmark stopwatch   example.php5   Download  
File: example.php5
Role: Example script
Content type: text/plain
Description: Example script
Class: Benchmark stopwatch
Measure the time a PHP script takes to execute
Author: By
Last change: Added more comments.
Date: 15 years ago
Size: 543 bytes
 

Contents

Class file image Download
<?php

require_once('timer.php5');

// Start timer
timer::start();

// break time with a comment
timer::stop('Stopped before sleeping.');

// break time without comment
timer::stop();

// Wait for 1 second.
sleep(1);

// break / stop time with a comment
timer::stop('Good morning.');

// print out values
echo '<pre>' . timer::getValuesFormatted() . '</pre>';

/*

Duration:
0.0001 sek "Stopped before sleeping."
0.0002 sek (+0.0001)
1.0001 sek "Good morning." (+0.9999)
==========================
1.0001 sek

*/