2017 © Pedro Peláez
 

library php-stopwatch

A simple stopwatch in PHP

image

kkiernan/php-stopwatch

A simple stopwatch in PHP

  • Monday, December 5, 2016
  • by kkiernan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 14 % Grown

The README.md

PHP Stopwatch

A simple stopwatch in PHP., (*1)

StyleCI, (*2)

Contents

Installation

Install the package using composer., (*3)

composer require kkiernan/php-stopwatch

Available Methods

  • start()
  • stop()
  • lap()
  • elapsed()

Basic Usage

use Kiernan\Stopwatch;

require dirname(__DIR__). '/vendor/autoload.php';

$stopwatch = new Stopwatch();

$stopwatch->start();

usleep(1500000);

$stopwatch->stop();

echo "Script executed in {$stopwatch->elapsed()} seconds";

The above example prints the following output:, (*4)

Script executed in 3.0002250671387 seconds

Laps

use Kiernan\Stopwatch;

require dirname(__DIR__). '/vendor/autoload.php';

$stopwatch = new Stopwatch();

$stopwatch->start();
sleep(1);
$stopwatch->lap();
sleep(2);
$stopwatch->lap();
sleep(1);
$stopwatch->lap();
$stopwatch->stop();

print_r($stopwatch->laps);

The above example prints the following output:, (*5)

Array
(
    [0] => Kiernan\Lap Object
        (
            [start:protected] => 1542305179.9815
            [duration:protected] => 1.0043249130249
            [name:protected] =>
        )

    [1] => Kiernan\Lap Object
        (
            [start:protected] => 1542305181.9823
            [duration:protected] => 2.0006990432739
            [name:protected] =>
        )

    [2] => Kiernan\Lap Object
        (
            [start:protected] => 1542305182.9823
            [duration:protected] => 1.0000500679016
            [name:protected] =>
        )

)

The Versions

05/12 2016

dev-master

9999999-dev

A simple stopwatch in PHP

  Sources   Download

MIT

The Development Requires

by Kelly Kiernan

05/12 2016

v1.0

1.0.0.0

A simple stopwatch in PHP

  Sources   Download

MIT

The Development Requires

by Kelly Kiernan