I. What is SPL? SPL is a set of interfaces and classes that are used to solve typical problems (standard problems). Data structure:1. Implementing a bidirectional list Spldoublylinkedlist implements Iterator, Arrayaccess, countable {}2A . Stack (stack) is a special linear table because it can only insert or delete elements at one end of a linear table (that is, the stack and the stack) Splstack extends Spld
According to the directory structure of the words (if you are not clear can see an article). I created a new simple.php within the simple folder.
[PHP]
Require ' includes/exceptions.php ';Require ' includes/autoloader.php ';Session_Start ();
$view = new View ();Lib::set_item (' controller ', new Controller ());Lib::get_item (' controller ', Lib::P Ersist_storge)->render ();$content = $view->finish ();
This chapter is mainly about SPL, so we only loo
According to the above directory structure (if not clear, you can refer to the previous article ). I created a new simple in the simple folder. php. [php] lt; p gt; require amp; #39; des/exceptions. php amp; #39; require amp; #39; des/autoloader. php amp
According to the above directory structure (if not clear, you can refer to the previous article ). I created a simple. php.
[Php]
Require 'Des/exceptions. php ';Require 'events des/autoloader. php ';Session_start ();
// $ View = new view (
File Operations in the php spl standard library
This article mainly introduces the file operations (SplFileInfo and SplFileObject) instance of the php spl standard library, this article describes how SplFileInfo is used to obtain file details, traverse SplFileObject, search for specified rows, and write csv files. For more information, see
Php spl provides SplFil
Spl_autoload is the default automatic load function that SPL implements, its function is relatively simple. It can receive two parameters, the first parameter is $class_name, the class name, the second parameter $file_extensions is optional, the extension of the class file "title=" extension > extension, can be in the $file_ extensions specifies multiple extension "title=" Extensions > extensions, separated by semicolons; if not specified, it will use
PHP SPL can be seen in many frameworks and MVC, and PHP SPL accounts for a large proportion of the actual applications.
Doubly linked list
Use of stacks
Queue
$que = new Splqueue (); $que->enqueue ("a"); into the queue $que->enqueue ("B"); $que->enqueue ("C");//print_r ($que); echo "Bottom". $que->bottom (). "
Arrayiterator
Appenditerator
Multipleiterator to synthesize the entire output of an array
Spl_autoload_register () :When a class is called Undefined, all functions registered to the Spl_autoload_register () function are called sequentially, instead of calling the __autoload function.solve the problem :The function __autoload ($classname) can be dynamically loaded classes, avoiding the use of require_once statements, but if you have a large-scale application that contains libraries or smaller applications, each application may want to declare a __ The AutoLoad function to find his fil
PHP SPL standard library data structure stack (splstack) Introduction, Splsplstack
A stack is a special linear table because it can only insert or delete elements at one end of a linear table (that is, the stack and the stack)
Splstack is the inherited doubly linked list (spldoublylinkedlist) implementation stack.
The class summary is as follows:
Simple to use as follows:
Think of the stack as an inverted array $stack = new Splstack ();/** * The di
Introduction: This is a detailed page of SPL spl_autoload_register and _ autoload usage examples. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 339372 'rolling = 'no'>
I have been writing a framework recently. Of course, I have learned a lot from my previous writing frameworks. Haha.
When talking about the automatic lo
Example of using SplFixedArray in the php spl standard library
This article mainly introduces the use of SplFixedArray in the php spl standard library. SplFixedArray is mainly used to process array-related functions. It is fixed-length and faster than normal Array Processing, for more information, see
SplFixedArray is mainly used to process array-related functions. Unlike Common php arrays, SplFixedArray is
Introduction to the data structure stack (SplStack) of the php spl standard library
This article mainly introduces the data structure Stack (SplStack) of the php spl standard library. Stack is a special linear table, because it can only insert or delete elements at one end of a linear table (that is, to stack and to stack), you can refer
Stack is a special linear table, because it can only insert or delete
SPL provides multiple iterator classes that provide iterative access, filtering data, caching results, and controlling paging. , because PHP is always growing, I try to list all of the iteration classes in SPL. Some of the following iterator classes are required php5.4, others such as the Searhiteratoer class have been removed in the latest PHP version 1.ArrayIteratoer from the PHP array to create an iterat
Arrays of PHP and SPL fixed arrays
PHP fixed arrays are part of a data structure of the PHP standard library (SPL). Compared to PHP normal arrays, fixed arrays can only be used to define its subscript, and, as the name suggests, is fixed length, its advantage is less than the normal array of memory consumption, and faster, specific reasons for the next analysis, a simple test, the first to put 10W a into t
The eight algorithms that have learned about internal sorting have been written in code implementations. The principle of heap sorting is
Initialize a binary tree to a heap
Swap the last node in turn with the top node of the heap. Then adjust the heap top element position and reset the heap.
Initializing a two-tree to a heap can be seen as starting from the last non-leaf node, adjusting the heap top element of the sub-heap in turn, and resetting the heap to refer to the reset h
This article mainly introduces the PHP SPL standard library file operations (Splfileinfo and Splfileobject) instances, this article explains Splfileinfo used to obtain file details, Splfileobject traversal, find the specified row, Write CSV file and so on content, need friends can refer to the following
PHP SPL provides splfileinfo and splfileobject two classes to handle file operations.
Splfileinfo used
) public void spldoublylinked List::setiteratormode (int $mode) public mixed spldoublylinkedlist::shift (void) public mixed spldoublylinkedlist::top (void) public void spldoublylinkedlist::unserialize (string $serialized) public void Spldoublylinkedlist::unshift (m
ixed $value) public bool Spldoublylinkedlist::valid (void)}
Example:
Class Stack {
private $splstack;
Public function __construct (Splstack $splstack) {
$this-> splstack = $splstack;
}
Public function
There are several predefined interfaces in PHP that compare four commonly used interfaces (countable,arrayaccess,Iterator, Iteratoraggregate (converged aggregate iterator iterator)).1. Countable interface As seen from the manual, the main class implementation countable can be used with the count () function. Example: PHPclassconutme{protected $_mycount= 3; Public function Count() { return $this-_mycount; }}$countable=NewConutme ();Echo Count($countable);///result is "1" and not a
SpldoublylinkedlistRewind: Causes the current pointer of the list to point to the bottom of the list (bottom)Push: Inserts a node to the top (tail) of the listPop: Gets the top (tail) node in the list and removes the node from the linked list; The operation does not change the position of the current pointerCurrent: A pointer to a list of nodes that must be called before calling Rewind. When a pointed node is deleted, it points to an empty node.Next: The pointer to the current node of the list p
This article is mainly to share with you in PHP the common data structure of SPL, mainly in the way of code and share with you, hope to help everyone.
This article stack "Advanced after Out"
2. Queue "Advanced first Out Backward"
3. Heap
4. Fixed size array
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.