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 "\r\n \r\n"; echo $obj->key(); echo "\r\n \r\n"; 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 "\r\n \r\n"; echo $obj->key(); echo "\r\n \r\n"; 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/BMLKD
function name:  (null)
number of ops:  49
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
   21    24        ECHO                                                     '%0D%0A+%0D%0A'
   22    25        INIT_METHOD_CALL                                         !0, 'key'
         26        DO_FCALL                                      0  $12     
         27        ECHO                                                     $12
   23    28        ECHO                                                     '%0D%0A+%0D%0A'
   24    29        ECHO                                                     '%3Cbr%3E+Rewinding+the+position+so+that+current+node+points+to+first+node+'
   25    30        INIT_METHOD_CALL                                         !0, 'rewind'
         31        DO_FCALL                                      0          
   27    32        ECHO                                                     '%3Cbr%3ECurrent+node+of+the+linked+list%3A'
   28    33        INIT_METHOD_CALL                                         !0, 'current'
         34        DO_FCALL                                      0  $14     
         35        ECHO                                                     $14
   29    36        ECHO                                                     '%0D%0A+%0D%0A'
   30    37        INIT_METHOD_CALL                                         !0, 'key'
         38        DO_FCALL                                      0  $15     
         39        ECHO                                                     $15
   31    40        ECHO                                                     '%0D%0A+%0D%0A'
   32    41        ECHO                                                     '%3Cbr%3EMoving+to+Next+node%3A'
   33    42        INIT_METHOD_CALL                                         !0, 'next'
         43        DO_FCALL                                      0          
   35    44        ECHO                                                     '%3Cbr%3EPrinting+the+next+node%3A'
   36    45        INIT_METHOD_CALL                                         !0, 'current'
         46        DO_FCALL                                      0  $17     
         47        ECHO                                                     $17
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.47 ms | 1400 KiB | 15 Q