PHP code example of camspiers / bench

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

    

camspiers / bench example snippets


bench\mark('somekey');
$result = calculateSomething();
echo bench\format(bench\collector()), PHP_EOL;

$result = bench\invoke('calculateSomething');
echo bench\format(bench\collector()), PHP_EOL;

$fn = bench\wrap('calculateSomething');
$result = $fn();
echo bench\format(bench\collector()), PHP_EOL;

bench\invoke('calculateSomething');
bench\invoke('calculateSomething');
foreach (bench\formatTimes(bench\collector()) as $time) {
	echo $time, PHP_EOL;
}