PHP code example of awheel / phptrie
1. Go to this page and download the library: Download awheel/phptrie 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/ */
awheel / phptrie example snippets
composer
$trie = new PhpTrie();
$words = ['我是', '我们', 'abcd'];
$string = '我们是违禁词: abcde';
$trie->addWord($words);
var_dump($trie->check($string))
var_dump($trie->search($string))
var_dump($trie->isWord('我们')))