3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pq = new SplPriorityQueue(); //insert method inserts an element in the queue by shifting it up $pq->insert('A', 3); $pq->insert('B', 6); $pq->insert('C', -1); $pq->insert('D', 2); //count the elements echo "count ->" . $pq->count(); //Sets the mode of extraction (EXTR_DATA, EXTR_PRIORITY, EXTR_BOTH) $pq->setExtractFlags(SplPriorityQueue::EXTR_BOTH); //go at the node from the top of the queue $clone1 = clone $pq; $clone1->top(); //iterate the queue (by priority) and display each element while ($clone1->valid()) { print_r($clone1->current()); $clone1->next(); } $clone2 = clone $pq; $clone2->top(); //iterate the queue (by priority) and display each element while ($clone2->valid()) { print_r($clone2->current()); $clone2->next(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 31
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 46
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 46
Branch analysis from position: 56
Branch analysis from position: 46
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 31
Branch analysis from position: 41
Branch analysis from position: 31
filename:       /in/Uf2MX
function name:  (null)
number of ops:  57
compiled vars:  !0 = $pq, !1 = $clone1, !2 = $clone2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'SplPriorityQueue'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    6     3        INIT_METHOD_CALL                                         !0, 'insert'
          4        SEND_VAL_EX                                              'A'
          5        SEND_VAL_EX                                              3
          6        DO_FCALL                                      0          
    7     7        INIT_METHOD_CALL                                         !0, 'insert'
          8        SEND_VAL_EX                                              'B'
          9        SEND_VAL_EX                                              6
         10        DO_FCALL                                      0          
    8    11        INIT_METHOD_CALL                                         !0, 'insert'
         12        SEND_VAL_EX                                              'C'
         13        SEND_VAL_EX                                              -1
         14        DO_FCALL                                      0          
    9    15        INIT_METHOD_CALL                                         !0, 'insert'
         16        SEND_VAL_EX                                              'D'
         17        SEND_VAL_EX                                              2
         18        DO_FCALL                                      0          
   12    19        INIT_METHOD_CALL                                         !0, 'count'
         20        DO_FCALL                                      0  $10     
         21        CONCAT                                           ~11     'count+-%3E', $10
         22        ECHO                                                     ~11
   15    23        INIT_METHOD_CALL                                         !0, 'setExtractFlags'
         24        SEND_VAL_EX                                              3
         25        DO_FCALL                                      0          
   18    26        CLONE                                            ~13     !0
         27        ASSIGN                                                   !1, ~13
   19    28        INIT_METHOD_CALL                                         !1, 'top'
         29        DO_FCALL                                      0          
   22    30      > JMP                                                      ->38
   23    31    >   INIT_FCALL                                               'print_r'
         32        INIT_METHOD_CALL                                         !1, 'current'
         33        DO_FCALL                                      0  $16     
         34        SEND_VAR                                                 $16
         35        DO_ICALL                                                 
   24    36        INIT_METHOD_CALL                                         !1, 'next'
         37        DO_FCALL                                      0          
   22    38    >   INIT_METHOD_CALL                                         !1, 'valid'
         39        DO_FCALL                                      0  $19     
         40      > JMPNZ                                                    $19, ->31
   27    41    >   CLONE                                            ~20     !0
         42        ASSIGN                                                   !2, ~20
   28    43        INIT_METHOD_CALL                                         !2, 'top'
         44        DO_FCALL                                      0          
   31    45      > JMP                                                      ->53
   32    46    >   INIT_FCALL                                               'print_r'
         47        INIT_METHOD_CALL                                         !2, 'current'
         48        DO_FCALL                                      0  $23     
         49        SEND_VAR                                                 $23
         50        DO_ICALL                                                 
   33    51        INIT_METHOD_CALL                                         !2, 'next'
         52        DO_FCALL                                      0          
   31    53    >   INIT_METHOD_CALL                                         !2, 'valid'
         54        DO_FCALL                                      0  $26     
         55      > JMPNZ                                                    $26, ->46
   34    56    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.53 ms | 1400 KiB | 15 Q