PHPackages                             giberti/array-functions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. giberti/array-functions

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

giberti/array-functions
=======================

Helpers for calculating descriptive statistics on arrays.

0.4.0(3mo ago)14MITPHPPHP ^7.1|^8.0CI passing

Since Oct 30Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/giberti/array-functions)[ Packagist](https://packagist.org/packages/giberti/array-functions)[ RSS](/packages/giberti-array-functions/feed)WikiDiscussions main Synced yesterday

READMEChangelog (4)Dependencies (1)Versions (4)Used By (0)

Array Functions
===============

[](#array-functions)

Provides additional array functionality, augmenting the built in `array_*` functions for use in common descriptive statistic calculations.

[![Build and Test](https://github.com/giberti/array-functions/actions/workflows/test-php.yml/badge.svg)](https://github.com/giberti/array-functions/actions/workflows/test-php.yml)

Installing
----------

[](#installing)

This library requires PHP 7.1 or newer, including 8.0 through 8.5.

```
composer require giberti/array-functions

```

Usage
-----

[](#usage)

#### string array\_fingerprint($array)

[](#string-array_fingerprintarray)

Creates a fingerprint for the array, useful for caching values.

```
$values = [1,2,2,3];
$fingerprint = array_fingerprint($values);
echo $fingerprint; // f591c5a8a39f752a2040e2364e775aec
```

#### float\[\] array\_bucket($array, \[$buckets = null\])

[](#float-array_bucketarray-buckets--null)

Groups array values into buckets suitable for source data for a histogram. Takes an optional parameter to force the number of buckets the content should be distributed into.

```
$values = [1,2,2,3,3,3];
$buckets = array_bucket($values);
print_r($buckets);
// Array (
//           [[0.5,1.5)] => 1
//           [[1.5,2.5)] => 2
//           [[2.5,3.5]] => 3
//       )
```

#### float array\_mean($array)

[](#float-array_meanarray)

Finds the mean (average) value of the elements in an array of numeric values.

```
$values = [1,2,2,3];
$mean = array_mean($values);
echo $mean; // 2
```

#### float array\_range($array)

[](#float-array_rangearray)

Finds the difference between the minimum value and the maximum value in the array.

```
$values = [1,2,3];
$difference = array_range($values);
echo $difference; // 2
```

#### float array\_variance($array \[, $sample = true\])

[](#float-array_variancearray--sample--true)

Finds the variance for a given array. Works with populations as well as samples.

```
$values = [1,2,2,3];
$variance = array_variance($values);
echo $variance; // 0.66666666666667

$standardDeviation = sqrt($variance);
echo $standardDeviation; // 0.81649658092773
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance81

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1324 days

Total

3

Last Release

103d ago

PHP version history (2 changes)v0.1.0PHP ^7.1

0.4.0PHP ^7.1|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/771060?v=4)[Erik Giberti](/maintainers/giberti)[@giberti](https://github.com/giberti)

---

Top Contributors

[![giberti](https://avatars.githubusercontent.com/u/771060?v=4)](https://github.com/giberti "giberti (26 commits)")

---

Tags

descriptive-statisticsphp7php8statistics

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/giberti-array-functions/health.svg)

```
[![Health](https://phpackages.com/badges/giberti-array-functions/health.svg)](https://phpackages.com/packages/giberti-array-functions)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
