$stat['bloom']['has']['s'] = get_stat(); $stat['bloom']['has']['errors'] = $bloom->has($check); $stat['bloom']['has']['e'] = get_stat(); /* * Check existance in array **/ $stat['array']['has']['s'] = get_stat(); for ($i = 0; $i < $number; $i++) { $stat['array']['has']['errors'][] = @in_array($check[$i], $array); } $stat['array']['has']['e'] = get_stat(); /* * Delete from bloom **/ $stat['bloom']['delete']['s'] = get_stat(); $bloom->delete($check); $stat['bloom']['delete']['e'] = get_stat(); /* * Check existance in array **/ $stat['array']['delete']['s'] = get_stat(); for ($i = 0; $i < $number; $i++) { if (isset($check[$i]) and isset($array[$check[$i]])) { unset($array[$check[$i]]); } } $stat['array']['delete']['e'] = get_stat(); /* * Results **/ $result['bloom']['insert']['time'] = $stat['bloom']['insert']['e']['timestamp'] - $stat['bloom']['insert']['s']['timestamp'];
public function testUnsetTestManyToManyValue() { $params = array('counter' => true); $bloom = new Bloom($params); for ($i = 0; $i < 10; $i++) { $vars[] = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 5); $res[] = true; } $bloom->set($vars); $this->assertEquals($res, $bloom->has($vars)); $this->assertEquals($res, $bloom->delete($vars)); $set = explode(',', $bloom->set); $this->assertEquals(0, array_sum($set)); }