primus852 / simple-stopwatch
Simple Stopwatch in PHP
Installs: 111
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- php: ^7.0
This package is auto-updated.
Last update: 2024-10-11 20:04:24 UTC
README
A simple Stopwatch utility for PHP
Usage
Start the Stopwatch
$start = StopWatch::start();
Default Output
$start = StopWatch::start();
sleep(3); // Sleep 3 seconds for testing
$end = Stopwatch::stop($start);
echo 'Elapsed: '.$end; //Elapsed: 0 hours, 0 minutes and 3 seconds
Specify Output format
$start = StopWatch::start();
sleep(3); // Sleep 3 seconds for testing
$end = Stopwatch::stop($start, true, 's');
echo 'Elapsed Seconds: '.$end; //Elapsed Seconds: 3
Get current timestamp including microseconds
$current = StopWatch::current();
echo $current; //2018-10-04 10:37:30.271700