3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * Examples of DoublyLinkedList */ $obj = new SplDoublyLinkedList(); // Check wither linked list is empty if ($obj->isEmpty()) { echo "Adding nodes to Linked List<br>"; $obj->push(2); $obj->push(3); echo "Adding the node at beginning of doubly linked list <br>"; $obj->unshift(10); } echo "<br>Our Linked List:"; print_r($obj); $curr = $obj->current(); // this will return NULL as we have not set initial node. echo "<br> Rewinding the position so that current node points to first node "; $obj->rewind(); echo "<br>Current node of the linked list:"; echo $obj->current(); // this will print first node of the linked list. echo "<br>Moving to Next node:"; $obj->next(); echo "<br>Printing the next node:"; echo $obj->current();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/1d5RW
function name:  (null)
number of ops:  39
compiled vars:  !0 = $obj, !1 = $curr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $2      'SplDoublyLinkedList'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    8     3        INIT_METHOD_CALL                                         !0, 'isEmpty'
          4        DO_FCALL                                      0  $5      
          5      > JMPZ                                                     $5, ->17
   10     6    >   ECHO                                                     'Adding+nodes+to+Linked+List%3Cbr%3E'
   11     7        INIT_METHOD_CALL                                         !0, 'push'
          8        SEND_VAL_EX                                              2
          9        DO_FCALL                                      0          
   12    10        INIT_METHOD_CALL                                         !0, 'push'
         11        SEND_VAL_EX                                              3
         12        DO_FCALL                                      0          
   13    13        ECHO                                                     'Adding+the+node+at+beginning+of+doubly+linked+list+%3Cbr%3E'
   14    14        INIT_METHOD_CALL                                         !0, 'unshift'
         15        SEND_VAL_EX                                              10
         16        DO_FCALL                                      0          
   17    17    >   ECHO                                                     '%3Cbr%3EOur+Linked+List%3A'
   18    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
   20    21        INIT_METHOD_CALL                                         !0, 'current'
         22        DO_FCALL                                      0  $10     
         23        ASSIGN                                                   !1, $10
   22    24        ECHO                                                     '%3Cbr%3E+Rewinding+the+position+so+that+current+node+points+to+first+node+'
   23    25        INIT_METHOD_CALL                                         !0, 'rewind'
         26        DO_FCALL                                      0          
   25    27        ECHO                                                     '%3Cbr%3ECurrent+node+of+the+linked+list%3A'
   26    28        INIT_METHOD_CALL                                         !0, 'current'
         29        DO_FCALL                                      0  $13     
         30        ECHO                                                     $13
   28    31        ECHO                                                     '%3Cbr%3EMoving+to+Next+node%3A'
   29    32        INIT_METHOD_CALL                                         !0, 'next'
         33        DO_FCALL                                      0          
   31    34        ECHO                                                     '%3Cbr%3EPrinting+the+next+node%3A'
   32    35        INIT_METHOD_CALL                                         !0, 'current'
         36        DO_FCALL                                      0  $15     
         37        ECHO                                                     $15
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.92 ms | 1396 KiB | 15 Q