| 
<?php
 ini_set('display_errors', 1);
 ini_set('display_startup_errors', 1);
 error_reporting(E_ALL);
 include_once 'RunTimeLogger.php';
 
 class A{
 public $timer;
 function __construct(){
 $this->timer=new RunTimeLogger();
 }
 public function runAnyMethod(){
 $this->timer->milestone(__METHOD__.'.start');
 try{
 sleep(10);
 }catch (Exception $e){
 $this->timer->milestone(__METHOD__.'.sleepfail');
 }
 $this->timer->milestone(__METHOD__.'.end');
 }
 }
 
 $timer=new RunTimeLogger(4, false);
 $obj=new A();
 ## any other script
 for($i=0; $i<99999999; $i++) $j='any task!';
 $timer('loopdone');
 $timer1=new RunTimeLogger(false);
 $timer2=new RunTimeLogger('simple timer of shahadat');
 $obj->runAnyMethod();
 echo '$obj->runAnyMethod() log: '.$timer('anymethodrundone').'<br />';
 echo 'just echo last log: '.$timer.'<br />';
 for($i=0; $i<999; $i++) $j='another task!';
 $timer('task2done');
 echo '<h3>now lets see log!</h3>
 <h5>global timer</h5><pre>'.print_r($timer(true), true).'</pre>
 <h5>class timer</h5><pre>'.print_r($obj->timer->get(true), true).'</pre>
 <h5>timer that didnot started</h5><pre>'.print_r($timer1(true), true).'</pre>
 <p>end of log</p>';
 
 
 
 |