1. Go to this page and download the library: Download brandonbronisz/php-bloom 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/ */
brandonbronisz / php-bloom example snippets
$filter = new Bloom\Filter(100000, 0.01);
$filter->add('[email protected]');
if ($filter->mightContain('[email protected]')) {
// The value might be present.
}
if (!$filter->mightContain('[email protected]')) {
// The value is definitely absent.
}
if (!$filter->mightContain($emailHash)) {
return false;
}
return $database->containsSuppression($emailHash);
bloom_version(): string
bloom_hash(string $value, int $seed = 0): int
bloom_optimal_bits(int $capacity, float $falsePositiveRate): int
bloom_optimal_hashes(int $bits, int $capacity): int
bloom_positions(string $value, int $bits, int $hashes): array
namespace Bloom;
final class Filter
{
public function __construct(int $capacity, float $falsePositiveRate = 0.01);
public function capacity(): int;
public function bits(): int;
public function hashes(): int;
public function bytes(): int;
public function add(string $value): void;
public function mightContain(string $value): bool;
public function export(): string;
public static function import(string $data): Filter;
public function setBits(): int;
public function fillRatio(): float;
public function estimatedFalsePositiveRate(): float;
public function stats(): array;
}