PHP code example of amnuts / timer

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

    

amnuts / timer example snippets




use Amnuts\Datetime\Timer;

$timer = new Timer();
sleep(5); // do something here
echo $timer->stop();



use Amnuts\Datetime\Timer;

$timer = new Timer();
sleep(1);
$timer->mark();
sleep(2);
$timer->mark();
sleep(3);
$timer->stop();

echo $timer;



use Amnuts\Datetime\Timer;

$timer = new Timer();
sleep(1);
$timer->mark('Starting something slow');
sleep(2);
$timer->mark('Ended that and going onto something even slower!');
sleep(3);
$timer->stop();

echo $timer;



use Amnuts\Datetime\Timer;

$timer = new Timer();
sleep(1);
echo $timer;
sleep(2);
echo $timer;