1. Go to this page and download the library: Download wikimedia/running-stat library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wikimedia / running-stat example snippets
use Wikimedia\RunningStat;
$rstat = new RunningStat();
foreach ( [
49.7168, 74.3804, 7.0115, 96.5769, 34.9458,
36.9947, 33.8926, 89.0774, 23.7745, 73.5154,
86.1322, 53.2124, 16.2046, 73.5130, 10.4209,
42.7299, 49.3330, 47.0215, 34.9950, 18.2914,
] as $sample ) {
$rstat->addObservation( $sample );
}
printf(
"n = %d; min = %.2f; max = %.2f; mean = %.2f; variance = %.2f; stddev = %.2f\n",
count( $rstat ),
$rstat->min,
$rstat->max,
$rstat->getMean(),
$rstat->getVariance(),
$rstat->getStdDev()
);
// Output:
// n = 20; min = 7.01; max = 96.58; mean = 47.59; variance = 725.71; stddev = 26.94
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.