Introduction and usages of PHP double-linked list (spldoublylinkedlist)

Source: Internet
Author: User
Tags bool count mixed rewind valid

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.