PHP code example of speedy / timer

1. Go to this page and download the library: Download speedy/timer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

speedy / timer example snippets




use Speedy\Timer\Timer;

$timer = new Timer();
$timer->start();
// some code
$item = $timer->stop();

var_dump($item->getTime()); // show run-time in milliseconds
var_dump($item->getTime(true)); // show run-time in microseconds



$timer = timer()->start();
//some code
$item = $timer->stop();

var_dump($item->getTime());




$timer = timer()->start('test1');
//some code
$timer = timer()->start('test2');
//some code
$item = $timer->stop('test1);
var_dump($item->getTime());
//some code
$item2 = $timer->stop('test2);
var_dump($item2->getTime())