PHP code example of juanf / phpbloomfilter

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

    

juanf / phpbloomfilter example snippets




use JuanF\Lib\BloomFilter;

// Init Redis backend (others can be implemented).
$persistence = JuanF\Lib\Persistence\Redis::init();

// Instantiate filter.
$filter = new BloomFilter($persistence);

// Create a new filter, passing a key, bit size, hash count.
$filter->create('filter_key', 10000, 3);

$filter->add("the value");

if ($filter->has('the value')) {
	echo "maybe\n";
}
else {
	echo "not\n";
}