PHP code example of gabrielef / timer

1. Go to this page and download the library: Download gabrielef/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/ */

    

gabrielef / timer example snippets


use gabrielef\Timer;

$t = new Timer();
$t->start('firstTimer', 3);

use gabrielef\Timer;

$t = new Timer();
$t->start('firstTimer', 3);

//...
//after 1s

echo $t->look('firstTimer'); //ex. 1.234

use gabrielef\Timer;
$t = new Timer();
$t->start('firstTimer');

//...
//after 3s

echo $t->end('firstTimer'); //ex. 3

use gabrielef\Timer;

$t = new Timer();
$t->start('firstTimer');
$t->start('secondTimer');
$t->start('thirdTimer');

$list = $t->list(); // ['firstTimer', 'secondTimer', 'thirdTimer]