PHP code example of noroman / codetimer

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

    

noroman / codetimer example snippets



odeTimer\CodeTimer;
// start global timer
$codeTimer = new CodeTimer();
//... code ...
// start first block
$codeTimer->runBlock('first block');
//... code ...
// stop first block
$codeTimer->stopBlock('first block');
//... code ...
// global checkpoint (start global timer)
print_r($codeTimer->checkPoint());
//... code ...
// start second block
$codeTimer->runBlock('second block');
//... code ...
// global checkpoint (start global timer)
print_r($codeTimer->checkPoint());
//... code ...
// stop second block
$codeTimer->stopBlock('second block');
//... code ...
print_r($codeTimer->blockInfo('first block'));
print_r($codeTimer->blockInfo('second block'));

// output to the browser console
$codeTimer->blockToBrowser('first block');
$codeTimer->checkPointToBrowser();