PHP code example of joruro / stopwatch
1. Go to this page and download the library: Download joruro/stopwatch 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/ */
joruro / stopwatch example snippets
oruro\Enum\TimeUnits;
use Joruro\Stopwatch\Stopwatch;
$attempts = 2;
$counter = 5;
Stopwatch::start();
for ($j = 0; $j < $attempts; $j++) {
Stopwatch::start();
for ($i = 0; $i < $counter; $i++) {
sleep(1);
}
$time = Stopwatch::stop(TimeUnits::SECONDS);
echo "A foreach of {$counter} loops took approximately {$time} seconds\n";
}
$time = Stopwatch::stop(TimeUnits::SECONDS);
echo "{$attempts} attempts foreach of {$counter} loops took approximately {$time} seconds\n";
exit(0);