PHP code example of malenki / tictactic
1. Go to this page and download the library: Download malenki/tictactic 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/ */
malenki / tictactic example snippets php
$t = \Malenki\TicTacTic::getInstance();
$t->start('foo');
sleep(4);
$t->finish('foo');
echo "\n";
echo $t->get('foo');
echo "\n";
php
= \Malenki\TicTacTic::getInstance();
$t->start('foo');
echo "\n";
echo $t->done('foo') ? 'FOO done' : 'FOO is running';
echo "\n";
sleep(3);
$t->finish('foo');
//$t->finish('thing'); // if uncommented, should throw exception
echo "\n";
echo $t->done('foo') ? 'FOO done' : 'FOO is running';
echo "\n";
$t->start('bar');
sleep(2);
$t->finish('bar');
$t->start('something');
sleep(1);
$t->finish('something');
echo "\n";
printf('%d timers:', count($t));
echo "\n";
echo $t->get('foo');
echo "\n";
echo $t->get('bar');
echo "\n";
echo $t->get('something');
echo "\n";
printf('Averages:', count($t));
echo "\n";
echo $t->average();
echo "\n";
echo $t->average(array('foo', 'something')); // for two of them only
echo "\n";
echo "\n";