This article mainly introduced the PHP double link list (spldoublylinkedlist) Introduction and the use example related material, needs the friend to be possible to refer to under
Double linked list is an important linear storage structure, for each node in a doubly linked list, not only store its own information, but also save the address of the predecessor and the successor node.
The Spldoublylinkedlist class in the PHP SPL provides an operation on a double linked list.
The Spldoublylinkedlist class summary is as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 This is the |
Spldoublylinkedlist implements iterator, arrayaccess, countable { public __construct (void) public void Add ( Mixed $index, mixed $newval)//The head node of the double linked list public mixed top (void)//Double linked list of the tail node public mixed bottom (void)//double TABLE element number PU Blic int count (void)//detect whether a double linked list is empty public bool IsEmpty (void) //Current node index public mixed key (void)//move to previous record public void prev (void)//move to the next record public void Next (void)//The current record public mixed (void)//To point the pointer at the beginning of the iteration public voi D Rewind (void) Check whether the double linked list also has nodes public bool valid (void) //Specifies whether the node at index has a public bool offsetexists (mixed $index )//Get the specified index node value public mixed Offsetget (mixed $index)//set at the specified index value public void Offsetset (mixed $index, mixed $nEwval)//delete specified index node public void Offsetunset (mixed $index) //from the tail of the Double linked list pops the element public mixed pop (void)//add element to the double linked list Tail public void push (mixed $value) //serialization store public string serialize (void)/deserialized public void Unserialize (stri ng $serialized) //Set Iteration mode public void Setiteratormode (int $mode)//Get iterative mode Spldoublylinkedlist::it_mode_lifo (Stac K style) Spldoublylinkedlist::it_mode_fifo (Queue style) public int getiteratormode (void) //dual-linked list head removal element public mi Xed shift (void)//double-linked table header add element public void Unshift (mixed $value) } |
It's easy to use.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 The |
|