:: PHP Aho-Corasick algorithm finite state machine) ::
Pure PHP Aho-Corasick algorithm finite state machine) and pattern match with a wildcard and a ternary trie.
Unittest:
$tree = new Ahocorasick\Ahocorasick();
$tree->add("AC");
$tree->add("GTG");
$tree->add("AACT");
echo $tree->match("ACCGAGTGCGTGGACAAACTACGATTGTGGAATGAACT","AC*GT");
$this->expectOutputString("ACCGAGT,ACCGAGTGCGT,ACCGAGTGCGTGGACAAACTACGATTGT,ACAAACTACGATTGT,ACTACGATTGT,ACGATTGT");
IMPORTANT INFORMATION
It need some bugfixes. The transition table has some problems.
Sourcecode: