fran6co/phptrie
最新稳定版本:v1.1
Composer 安装命令:
composer require fran6co/phptrie
包简介
PHP Trie implementation
README 文档
README
A PHP implementation of a Trie, which is a data structure mainly used for fast string keys searches.
How to use PHPTrie
Creating a new PHPTrie structure
<?php
use PHPTrie\Trie;
$trie = new Trie();
?>
This creates an empty Trie.
Inserting elements
You can add entries to the PHPTrie by specifying a key and a value.
$trie = new Trie();
$trie->add("key", 10);
or
$trie = new Trie();
$trie->add("This can be any string!", $myArray);
or
$trie = new Trie();
$trie->add("Make sure it's a string...", $stdClassObject);
Your values should probably have a consistent type throughout the whole trie, but exactly how you structure your values is up to you.
From here on, we will assume that the PHPTrie object has been constructed and is called $trie.
Overwrite values
By default the add method overwrites the values if already exists, if you want to avoid that you can use
$trie->add("blah", 11, false);
统计信息
- 总下载量: 12.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 35
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2013-05-24