承接 fran6co/phptrie 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 35
  • Watchers: 2
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2013-05-24