PHP code example of maxwilms / bloom-filter

1. Go to this page and download the library: Download maxwilms/bloom-filter 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/ */

    

maxwilms / bloom-filter example snippets




axwilms\BloomFilter\BloomFilterGenerator;

// generate a bloom filter for 1000 elements with a probability of 1% for false positives
$bloomFilter = BloomFilterGenerator::generate(1000, 0.01); 

$bloomFilter->add('foo');
$bloomFilter->add('bar');
// ... add more

$bloomFilter->contains('foo'); // true - possibly in set
$bloomFilter->contains('baz'); // false - definitely not in set