SPL提供了一组标准数据结构。

  • SplDoublyLinkedList Class:双向链表(DLL)是在两个方向上相互链接的节点列表。当底层结构是dll时,迭代器的操作、对两端的访问、节点的添加或删除均是O(1),为堆栈和队列提供了良好的实现

    SplDoublyLinkedList::add — Add/insert a new value at the specified index
    SplDoublyLinkedList::bottom — Peeks at the node from the beginning of the doubly linked list
    SplDoublyLinkedList::__construct — Constructs a new doubly linked list
    SplDoublyLinkedList::count — Counts the number of elements in the doubly linked list.
    SplDoublyLinkedList::current — Return current array entry
    SplDoublyLinkedList::getIteratorMode — Returns the mode of iteration
    SplDoublyLinkedList::isEmpty — Checks whether the doubly linked list is empty.
    SplDoublyLinkedList::key — Return current node index
    SplDoublyLinkedList::next — Move to next entry
    SplDoublyLinkedList::offsetExists — Returns whether the requested $index exists
    SplDoublyLinkedList::offsetGet — Returns the value at the specified $index
    SplDoublyLinkedList::offsetSet — Sets the value at the specified $index to $newval
    SplDoublyLinkedList::offsetUnset — Unsets the value at the specified $index
    SplDoublyLinkedList::pop — Pops a node from the end of the doubly linked list
    SplDoublyLinkedList::prev — Move to previous entry
    SplDoublyLinkedList::push — Pushes an element at the end of the doubly linked list
    SplDoublyLinkedList::rewind — Rewind iterator back to the start
    SplDoublyLinkedList::serialize — Serializes the storage
    SplDoublyLinkedList::setIteratorMode — Sets the mode of iteration
    SplDoublyLinkedList::shift — Shifts a node from the beginning of the doubly linked list
    SplDoublyLinkedList::top — Peeks at the node from the end of the doubly linked list
    SplDoublyLinkedList::unserialize — Unserializes the storage
    SplDoublyLinkedList::unshift — Prepends the doubly linked list with an element
    SplDoublyLinkedList::valid — Check whether the doubly linked list contains more nodes
  • SplStack Class:该类继承自SplDoublyLinkedList,通过使用一个双向链表来提供栈的主要功能
    SplStack::__construct — Constructs a new stack implemented using a doubly linked list
    SplStack::setIteratorMode — Sets the mode of iteration
  • SplQueue Class:该类继承自SplDoublyLinkedList,通过使用一个双向链表来提供队列的主要功能
    SplQueue::__construct — Constructs a new queue implemented using a doubly linked list
    SplQueue::dequeue — Dequeues a node from the queue
    SplQueue::enqueue — Adds an element to the queue.
    SplQueue::setIteratorMode — Sets the mode of iteration
  • SplHeap:该abstract类提供了堆的主要功能。堆是满足堆属性的树型结构:每个节点都大于或等于其子节点
    SplHeap::compare — Compare elements in order to place them correctly in the heap while sifting up.
    SplHeap::__construct — Constructs a new empty heap
    SplHeap::count — Counts the number of elements in the heap.
    SplHeap::current — Return current node pointed by the iterator
    SplHeap::extract — Extracts a node from top of the heap and sift up.
    SplHeap::insert — Inserts an element in the heap by sifting it up.
    SplHeap::isEmpty — Checks whether the heap is empty.
    SplHeap::key — Return current node index
    SplHeap::next — Move to the next node
    SplHeap::recoverFromCorruption — Recover from the corrupted state and allow further actions on the heap.
    SplHeap::rewind — Rewind iterator back to the start (no-op)
    SplHeap::top — Peeks at the node from the top of the heap
    SplHeap::valid — Check whether the heap contains more nodes
  • SplMaxHeap Class:该类继承自SplHeap,提供了大顶堆的主要功能
    SplMaxHeap::compare — Compare elements in order to place them correctly in the heap while sifting up.
  • SplMinHeap class:该类继承自SplHeap,提供了小顶堆的主要功能
    SplMinHeap::compare — Compare elements in order to place them correctly in the heap while sifting up.
  • SplPriorityQueue Class:该类提供优先队列的功能,以大顶堆来实现的
    SplPriorityQueue::compare — Compare priorities in order to place elements correctly in the heap while sifting up.
    SplPriorityQueue::__construct — Constructs a new empty queue
    SplPriorityQueue::count — Counts the number of elements in the queue.
    SplPriorityQueue::current — Return current node pointed by the iterator
    SplPriorityQueue::extract — Extracts a node from top of the heap and shift up.
    SplPriorityQueue::insert — Inserts an element in the queue by sifting it up.
    SplPriorityQueue::isEmpty — Checks whether the queue is empty.
    SplPriorityQueue::key — Return current node index
    SplPriorityQueue::next — Move to the next node
    SplPriorityQueue::recoverFromCorruption — Recover from the corrupted state and allow further actions on the queue.
    SplPriorityQueue::rewind — Rewind iterator back to the start (no-op)
    SplPriorityQueue::setExtractFlags — Sets the mode of extraction
    SplPriorityQueue::top — Peeks at the node from the top of the queue
    SplPriorityQueue::valid — Check whether the queue contains more nodes
  • SplFixedArray Class:这里的array是以连续方式存储数据的结构,可以通过索引访问,与PHP数组是有序哈希表实现不同;另外,SplFixedArray 拥有固定长度、整数indexes,速度更快
    SplFixedArray::__construct — Constructs a new fixed array
    SplFixedArray::count — Returns the size of the array
    SplFixedArray::current — Return current array entry
    SplFixedArray::fromArray — Import a PHP array in a SplFixedArray instance
    SplFixedArray::getSize — Gets the size of the array
    SplFixedArray::key — Return current array index
    SplFixedArray::next — Move to next entry
    SplFixedArray::offsetExists — Returns whether the requested index exists
    SplFixedArray::offsetGet — Returns the value at the specified index
    SplFixedArray::offsetSet — Sets a new value at a specified index
    SplFixedArray::offsetUnset — Unsets the value at the specified $index
    SplFixedArray::rewind — Rewind iterator back to the start
    SplFixedArray::setSize — Change the size of an array
    SplFixedArray::toArray — Returns a PHP array from the fixed array
    SplFixedArray::valid — Check whether the array contains more elements
    SplFixedArray::__wakeup — Reinitialises the array after being unserialised
  • SplObjectStorage Class:该类提供了一个从对象到数据(或忽略数据)的map,是一种对象集合
    SplObjectStorage::addAll — Adds all objects from another storage
    SplObjectStorage::attach — Adds an object in the storage
    SplObjectStorage::contains — Checks if the storage contains a specific object
    SplObjectStorage::count — Returns the number of objects in the storage
    SplObjectStorage::current — Returns the current storage entry
    SplObjectStorage::detach — Removes an object from the storage
    SplObjectStorage::getHash — Calculate a unique identifier for the contained objects
    SplObjectStorage::getInfo — Returns the data associated with the current iterator entry
    SplObjectStorage::key — Returns the index at which the iterator currently is
    SplObjectStorage::next — Move to the next entry
    SplObjectStorage::offsetExists — Checks whether an object exists in the storage
    SplObjectStorage::offsetGet — Returns the data associated with an object
    SplObjectStorage::offsetSet — Associates data to an object in the storage
    SplObjectStorage::offsetUnset — Removes an object from the storage
    SplObjectStorage::removeAll — Removes objects contained in another storage from the current storage
    SplObjectStorage::removeAllExcept — Removes all objects except for those contained in another storage from the current storage
    SplObjectStorage::rewind — Rewind the iterator to the first storage element
    SplObjectStorage::serialize — Serializes the storage
    SplObjectStorage::setInfo — Sets the data associated with the current iterator entry
    SplObjectStorage::unserialize — Unserializes a storage from its string representation
    SplObjectStorage::valid — Returns if the current iterator entry is valid

Standard PHP Library(SPL)中的数据结构的更多相关文章

  1. php spl标准库简介(SPL是Standard PHP Library(PHP标准库)(直接看代码实例,特别方便)

    php spl标准库简介(SPL是Standard PHP Library(PHP标准库)(直接看代码实例,特别方便) 一.总结 直接看代码实例,特别方便易懂 thinkphp控制器利眠宁不支持(说明 ...

  2. [c++] STL = Standard Template Library

    How many people give up, because of YOU. Continue... 先实践,最后需要总结. 1. 数据流中的数据按照一定的格式<T>提取 ------ ...

  3. C++ Standard Template Library STL(undone)

    目录 . C++标准模版库(Standard Template Library STL) . C++ STL容器 . C++ STL 顺序性容器 . C++ STL 关联式容器 . C++ STL 容 ...

  4. 自定义标签 与 JSTL(JSP Standard Tag Library)

    1.自定义标签 [理解]     [1]简介            > 在JSP2.0以后,在jsp页面中不建议使用脚本片段<% %>和JSP表达式<%= %>     ...

  5. JSTL的全称:JSP Standard Tag Library, jsp 标准标签库

    JSTL的全称:JSP Standard Tag Library, jsp 标准标签库 JSTL的作用     提供给Java web开发人员一个标准通过的标签函数库和EL来取代传统直接在页面上嵌入j ...

  6. JSTL(JSP Standard Tag Library ,JSP标准标签库)

    JSTL标签之核心标签   JSTL(JSP Standard Tag Library ,JSP标准标签库)是一个实现 Web应用程序中常见的通用功能的定制标记库集,这些功能包括迭代和条件判断.数据管 ...

  7. JSTL 标准标签库 (JavaServer Pages Standard Tag library, JSTL)

    JSP标准标签库(JavaServer Pages Standard Tag Library,JSTL)是一个定制标签库的集合,用来解决 像遍历Map或集合.条件测试.XML处理,甚至数据 库访问和数 ...

  8. [C#] .NET Core/Standard 1.X 项目中如何使用XmlIgnoreAttribute等标准范围外的内容,兼谈如何解决“violation of security transparency rules failed”(违反安全透明规则失败)异常

    作者: zyl910 一.缘由 XML序列化是一个很常用的功能,但对于.NET Core/Standard,其直到2.0版才内置支持XML序列化.具体来说, .NET Core 2.0 或 .NET ...

  9. 为什么要使用 SPL中的 SplQueue实现队列

    今天看php的SPL标准库部分里面涉及到数据结构其中有 SplQueue 来实现队列效果,但是我刚接触php的时候学习到的是 使用array的 array_push 和 array_pop 就可以实现 ...

随机推荐

  1. js 继承的简单易懂小例子

    js 继承 今天主要说原型链继承.构造继承.组合继承三种常用继承方式,分享一下我的理解. 原型链继承例子1 //原型继承function A(name){ this.name = name;}func ...

  2. 使用背景图修改radio、checkbox样式

    如果觉得设置样式太麻烦,或者页面上选中的样式太复杂,也可以用背景图去修改样式<div class=""> <label><input type=&qu ...

  3. C#中的Explicit和Implicit

    今天在Review一个老项目的时候,看到一段奇怪的代码. if (dto.Payment == null) continue; var entity = entries.FirstOrDefault( ...

  4. 这是我对GET与POST的区别的回答

    不知在哪里看到的这种答案,之前很长一段时间对GET与POST的区别理解如下 一是GET数据附加在URL之后,是显示的,不安全的,POST反之. 二是数据大小限制,GET受URL长度限制,数据有限,PO ...

  5. B. Simple Game( Codeforces Round #316 (Div. 2) 简单题)

    B. Simple Game time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  6. Material使用05 自定义主题、黑夜模式\白天模式切换

    需求: 1 不使用materil依赖内建的主题,使用自己创建的主题 2 利用自己创建的主题实现白天模式和黑夜模式 1 自定义主题 1.1 创建自定义主题文件 them.scss // 引入materi ...

  7. Python笔记·第四章—— 细数Python中的数据类型以及他们的方法

    一.数据类型的种类及主要功能 1.数字类型 数字类型主要是用来计算,它分为整数类型int和浮点类型float 2.布尔类型 布尔类型主要是用于判断,它分为真True和False两种 3.字符串类型 字 ...

  8. jsp页面制作弹出框

    各种弹出页面的设计 [1.普通的弹出窗口] 其实代码非常简单: <SCRIPT LANGUAGE=javascript> <!-- window.open ('page.html') ...

  9. Eclipse 问题整理

    新建servlet报错,提示找不到javax.servlet包 解决的方法:把tomcat安装包里的lib目录下的servlet-api.jar拷贝一份到工程文件夹下的web目录下的WEB-INF目录 ...

  10. 转:IT巨头纷纷“卡位” 智能语音成人机交互入口必争之地

    http://www.cs.com.cn/xwzx/hwxx/201707/t20170712_5368595.html 随着物联网的迅速发展,作为重要接口的智能语音技术已成为国内外IT巨头的必争之地 ...