1. Go to this page and download the library: Download pouya1364/probabilistic-php 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/ */
pouya1364 / probabilistic-php example snippets
use Probabilistic\BloomFilter;
use Probabilistic\CountingBloomFilter;
use Probabilistic\CuckooFilter;
use Probabilistic\CountMinSketch;
use Probabilistic\HyperLogLog;
$hll = new HyperLogLog(precision: 14); // ~16 KB of memory
foreach ($visitorIds as $id) {
$hll->add($id);
}
$hll->estimate(); // approximately the number of distinct visitor IDs
use Probabilistic\Exception\ExceptionInterface;
try {
$bloom = BloomFilter::create(expectedItems: 0, falsePositiveRate: 0.01);
} catch (ExceptionInterface $e) {
// any error originating from this package
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.