Location: PHPKode > scripts > Benchmark stopwatch > benchmark-stopwatch/example.php5
<?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

*/
Return current item: Benchmark stopwatch