PHP code example of district5 / timer

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

    

district5 / timer example snippets


$stopwatch = new \District5\Timer\Stopwatch();
$stopwatch->start();

...

$secondsPassed = $stopwatch->secondsPassed();

$maxTimeSeconds = 300;

$stopwatch = new \District5\Timer\Stopwatch($maxTimeSeconds);
$stopwatch->start();

while (!$stopwatch->hasMaxTimePassed())
{
    // do some work
}