blister/php-linkedlist
最新稳定版本:0.1.0
Composer 安装命令:
composer require blister/php-linkedlist
包简介
A speedy DoubleLinkedList data structure implementation.
README 文档
README
A speedy LinkedList and DoubleLinkedList data structure implementation in PHP.
Installation
composer require blister/linkedlist
Usage
$list = new Blister\LinkedList(); // Add to the end of the LinkedList $list->push('Hello!'); $list->push('World!'); $list->push(array('key' => 'val')); $list->push(true); $list->push('Last!'); // Add to the front of the LinkedList $list->unshift('New First!'); // Get the length of the LinkedList $len = $list->length; // 6 // Searching inside the list $found_index = $list->index('World!'); // 2 $found = $list->find('World'); // true $found = $list->find('Missing'); // false // removing elements $last = $list->pop(); // 'Last!' $first = $list->shift(); // 'First!' $middle = $list->remove('World!'); // 'World!' $third = $list->removeAt(1); // array('key' => 'val')
Tests
This LinkedList implementation comes with a full suite of PHPUnit tests.
composer run-script test
Future
-
toArray():array -
findAll(mixed $needle):array -
fill(int $count, mixed $value):bool -
findFromTail(mixed $needle):mixed -
indexFromTail(mixed $needle):int -
print():void
Author
Eric Ryan Harrison, @blister
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-14