PHP code example of audentio / timer

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

    

audentio / timer example snippets




use Audentio\Timer\Timer;

$timer = new Timer(15);

while (true) {
    // Perform some action...
    if ($timer->hasExceededLimit()) {
        break;
    }
}



use Audentio\Timer\Timer;

$timer = new Timer();

sleep(15);

$duration = $timer->end();

echo 'Action time in milliseconds: ' . number_format($duration->getMilliseconds());