{"id":16814447,"url":"https://github.com/giberti/array-functions","last_synced_at":"2025-06-27T15:07:07.875Z","repository":{"id":62510633,"uuid":"155214800","full_name":"giberti/array-functions","owner":"giberti","description":"Functions for computing descriptive statistics about numeric data sets.","archived":false,"fork":false,"pushed_at":"2023-05-21T12:56:00.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-27T15:05:55.434Z","etag":null,"topics":["descriptive-statistics","php7","php8","statistics"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giberti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-29T13:16:22.000Z","updated_at":"2023-05-21T12:57:19.000Z","dependencies_parsed_at":"2025-01-23T22:24:40.932Z","dependency_job_id":"4b53fc02-5c76-45d0-acc7-0b9ff26d2c75","html_url":"https://github.com/giberti/array-functions","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/giberti/array-functions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giberti%2Farray-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giberti%2Farray-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giberti%2Farray-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giberti%2Farray-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giberti","download_url":"https://codeload.github.com/giberti/array-functions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giberti%2Farray-functions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262279106,"owners_count":23286548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["descriptive-statistics","php7","php8","statistics"],"created_at":"2024-10-13T10:29:29.265Z","updated_at":"2025-06-27T15:07:07.850Z","avatar_url":"https://github.com/giberti.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Array Functions\n\nProvides additional array functionality, augmenting the built in `array_*` functions for use in common descriptive statistic calculations.\n\n[![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)\n\n## Installing\n\nThis library requires PHP 7.1 or newer, including 8.0, 8.1, and 8.2.\n\n```\ncomposer require giberti/array-functions\n```\n\n## Usage\n\n#### string array_fingerprint($array)\n\nCreates a fingerprint for the array, useful for caching values.\n```php\n$values = [1,2,2,3];\n$fingerprint = array_fingerprint($values);\necho $fingerprint; // f591c5a8a39f752a2040e2364e775aec\n```\n\n#### float[] array_bucket($array, [$buckets = null])\nGroups 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.\n```php\n$values = [1,2,2,3,3,3];\n$buckets = array_bucket($values);\nprint_r($buckets);\n// Array (\n//           [[0.5,1.5)] =\u003e 1\n//           [[1.5,2.5)] =\u003e 2\n//           [[2.5,3.5]] =\u003e 3\n//       )\n```\n\n\n#### float array_mean($array)\n\nFinds the mean (average) value of the elements in an array of numeric values.\n```php\n$values = [1,2,2,3];\n$mean = array_mean($values);\necho $mean; // 2\n```\n\n#### float array_range($array)\n\nFinds the difference between the minimum value and the maximum value in the array.\n```php\n$values = [1,2,3];\n$difference = array_range($values);\necho $difference; // 2\n```\n\n#### float array_variance($array [, $sample = true])\n\nFinds the variance for a given array. Works with populations as well as samples.\n\n```php\n$values = [1,2,2,3];\n$variance = array_variance($values);\necho $variance; // 0.66666666666667\n\n$standardDeviation = sqrt($variance);\necho $standardDeviation; // 0.81649658092773\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiberti%2Farray-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiberti%2Farray-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiberti%2Farray-functions/lists"}