Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oefenweb/php-statistics
Statistics library for PHP
https://github.com/oefenweb/php-statistics
php statistics
Last synced: about 1 month ago
JSON representation
Statistics library for PHP
- Host: GitHub
- URL: https://github.com/oefenweb/php-statistics
- Owner: Oefenweb
- License: mit
- Created: 2015-05-31T18:06:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-03-23T10:43:40.000Z (almost 3 years ago)
- Last Synced: 2024-11-06T20:50:28.542Z (about 2 months ago)
- Topics: php, statistics
- Language: PHP
- Size: 44.9 KB
- Stars: 32
- Watchers: 4
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# php-statistics
[![Build Status](https://travis-ci.org/Oefenweb/php-statistics.svg?branch=master)](https://travis-ci.org/Oefenweb/php-statistics)
[![PHP 7 ready](http://php7ready.timesplinter.ch/Oefenweb/php-statistics/badge.svg)](https://travis-ci.org/Oefenweb/php-statistics)
[![codecov](https://codecov.io/gh/Oefenweb/php-statistics/branch/master/graph/badge.svg)](https://codecov.io/gh/Oefenweb/php-statistics)
[![Packagist downloads](http://img.shields.io/packagist/dt/Oefenweb/statistics.svg)](https://packagist.org/packages/oefenweb/statistics)
[![Code Climate](https://codeclimate.com/github/Oefenweb/php-statistics/badges/gpa.svg)](https://codeclimate.com/github/Oefenweb/php-statistics)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Oefenweb/php-statistics/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Oefenweb/php-statistics/?branch=master)Statistics library for PHP.
## Requirements
* PHP 7.2.0 or greater.
## Usage
### Sum
```php
use Oefenweb\Statistics\Statistics;Statistics::sum([1, 2, 3]); // 6
```### Minimum
```php
use Oefenweb\Statistics\Statistics;Statistics::min([1, 2, 3]); // 1
```### Maximum
```php
use Oefenweb\Statistics\Statistics;Statistics::max([1, 2, 3]); // 3
```### Mean
```php
use Oefenweb\Statistics\Statistics;Statistics::mean([1, 2, 3]); // 2
```### Frequency
```php
use Oefenweb\Statistics\Statistics;Statistics::frequency([1, 2, 3, 3, 3]); // [1 => 1, 2 => 1, 3 => 3]
```### Mode
```php
use Oefenweb\Statistics\Statistics;Statistics::mode([1, 2, 2, 3]); // 2
```### Variance (sample and population)
```php
use Oefenweb\Statistics\Statistics;Statistics::variance([1, 2, 3]); // 1
Statistics::variance([1, 2, 3], false); // 0.66666666666667
```### Standard deviation (sample and population)
```php
use Oefenweb\Statistics\Statistics;Statistics::standardDeviation([1, 2, 3]); // 1.0
Statistics::standardDeviation([1, 2, 3], false); // 0.81649658092773
```### Range
```php
use Oefenweb\Statistics\Statistics;Statistics::range([4, 6, 10, 15, 18]); // 14
```