Skip to content

Instantly share code, notes, and snippets.

@barryo
Created June 8, 2012 06:40
Show Gist options
  • Save barryo/2893980 to your computer and use it in GitHub Desktop.
Save barryo/2893980 to your computer and use it in GitHub Desktop.
The most simple timing tool for PHP
<?php
require_once( 'Timer.php' );
Timer::start();
// do something
echo "Time elapsed: " . Timer::end() . "\n";
<?php
class Timer
{
static private $_start = null;
static public function start()
{
self::$_start = microtime( true );
}
static public function end()
{
return self::$_time = microtime( true ) - self::$_start;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment