PHP standard library SPL data structure-----spldoublylinkedlist (doubly linked list)

Source: Internet
Author: User
Tags spl rewind
          $SPL =new spldoublylinkedlist ();          Instantiate an object $spl->push ("Sdfsaf") of a doubly linked list;  Added to the top (top) (tail) of the list $SPL->push (111);  $SPL->push (' 1 ');        $SPL->unshift ("100"); The value added to the bottom of the list (bottom) (head) value in the doubly linked list $SPL->shift (); //Delete bottom (head) at the location of the values         &NB SP; $spl->pop ();  //pop-up top value   $SPL->top ();    //get Top (trailing) elements $SPL-&G  T;count () Number of; //nodes          $SPL->isempty (); is currently empty, returns true for null     $SPL->rewind ();    //move to bottom (head) position    &NB sp;      $spl->current (); //Get the value of the current node $spl->next ();  //Move the node down  &N                         bsp;         $spl->prev ();  //Return to previous node//Loop through linked list   $SPL->rewind ();              &NBsp  while ($name = $spl->current ()) {                       echo $name. " \ n ";                      $SPL Next ();                 }/******************* /          &nbs P     for ($spl->rewind (); $spl->valid (); $spl->next ()) {                        echo $spl->current (). " \ n ";            } var_dump ($spl->valid ()); Returns true if the node is a valid node, otherwise false//NOTE: When $spl->current (), $SPL->valid () must be $spl->rewind (); Otherwise point to empty nodes  

The above describes the PHP standard database SPL data structure-----spldoublylinkedlist (doubly linked list), including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    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: 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.