PHP code example of giraffesummer / stopwatch

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

    

giraffesummer / stopwatch example snippets


use GiraffeSummer\Stopwatch\Stopwatch;

$sw = new Stopwatch();

 $sw->start(); //00:00:00.000
 

 $sw->lap(); //00:00:05.9547
 

$sw->reset();

$sw = new Stopwatch();
echo $sw->start();
$sleep = rand(1, 5);
echo "sleep: " . $sleep;
sleep($sleep);
echo $sw->lap();