Trie Implementation in PHP