PHP code example of izabolotnev / php-timer

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

    

izabolotnev / php-timer example snippets


use izabolotnev\Timer;

Timer::start();

// ...

$time = Timer::stop();

print Timer::secondsToTimeString($time);

use izabolotnev\Timer;

Timer::start();

// ...

print Timer::stopAndFormat();

use izabolotnev\Timer;

Timer::addNewTimer('myTimer');
Timer::start();

sleep(2);

Timer::start('myTimer');
echo 'Default: ', Timer::stopAndFormat(), PHP_EOL;

sleep(3);

echo 'Custom: ', Timer::stopAndFormat('myTimer'), PHP_EOL;