oefenweb/statistics

Statistics library for PHP

Maintainers

👁 oefenweb

Package info

github.com/Oefenweb/php-statistics

Homepage

pkg:composer/oefenweb/statistics

Statistics

Installs: 403 023

Dependents: 1

Suggesters: 0

Stars: 32

Open Issues: 2

v3.0.1 2022-03-23 10:43 UTC

Requires

  • php: >=7.0.0

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 55d66bdd6555dfe9b11ac58e29430c4653e1c492

statistics

This package is auto-updated.

Last update: 2026-06-23 19:32:44 UTC


README

👁 Build Status
👁 PHP 7 ready
👁 codecov
👁 Packagist downloads
👁 Code Climate
👁 Scrutinizer Code Quality

Statistics library for PHP.

Requirements

  • PHP 7.2.0 or greater.

Usage

Sum

use Oefenweb\Statistics\Statistics;

Statistics::sum([1, 2, 3]); // 6

Minimum

use Oefenweb\Statistics\Statistics;

Statistics::min([1, 2, 3]); // 1

Maximum

use Oefenweb\Statistics\Statistics;

Statistics::max([1, 2, 3]); // 3

Mean

use Oefenweb\Statistics\Statistics;

Statistics::mean([1, 2, 3]); // 2

Frequency

use Oefenweb\Statistics\Statistics;

Statistics::frequency([1, 2, 3, 3, 3]); // [1 => 1, 2 => 1, 3 => 3]

Mode

use Oefenweb\Statistics\Statistics;

Statistics::mode([1, 2, 2, 3]); // 2

Variance (sample and population)

use Oefenweb\Statistics\Statistics;

Statistics::variance([1, 2, 3]); // 1
Statistics::variance([1, 2, 3], false); // 0.66666666666667

Standard deviation (sample and population)

use Oefenweb\Statistics\Statistics;

Statistics::standardDeviation([1, 2, 3]); // 1.0
Statistics::standardDeviation([1, 2, 3], false); // 0.81649658092773

Range

use Oefenweb\Statistics\Statistics;

Statistics::range([4, 6, 10, 15, 18]); // 14