PHP code example of angle / chrono

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

    

angle / chrono example snippets


use Angle\Chrono;

echo Chrono::benchmark(function () {
    sleep(1);
});

echo Chrono::benchmark(function () {
    sleep(1);
}, 'ms');

Chrono::start();

// Do something...

echo Chrono::stop(); // 2.42424242 (seconds)

Chrono::start();

// Compute stuff

echo Chrono::meter(); // Time: 0.42 seconds (4242 ms)

echo Chrono::elapsed(); // 0.42424242
echo Chrono::seconds(); // 0.43
echo Chrono::ms(); // 4243

Chrono::start();

sleep(1);

Chrono::pause();

sleep(3); // Will be ignored

Chrono::resume();

sleep(1);

print Chrono::meter(); // Time: 2 seconds (2001 ms)

Chrono::describe('Query with joints');
Chrono::start();

// Run the query

print Chrono::meter();

Chrono::benchmark(function () {
    Chrono::describe('Task');

    // Do your thing
});