3v4l.org

run code in 300+ PHP versions simultaneously
<?php class JupilerLeague extends SplHeap { /** * We modify the abstract method compare so we can sort our * rankings using the values of a given array */ public function compare($array1, $array2) { $values1 = array_values($array1); $values2 = array_values($array2); if ($values1[0] === $values2[0]) return 0; return $values1[0] < $values2[0] ? -1 : 1; } } // Let's populate our heap here (data of 2009) $heap = new JupilerLeague(); $heap->insert(array ('AA Gent' => 15)); $heap->insert(array ('Anderlecht' => 20)); $heap->insert(array ('Cercle Brugge' => 11)); $heap->insert(array ('Charleroi' => 12)); $heap->insert(array ('Club Brugge' => 21)); $heap->insert(array ('G. Beerschot' => 15)); print_r(iterator_to_array($heap)); print_r(iterator_to_array($heap));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KkdZ4
function name:  (null)
number of ops:  34
compiled vars:  !0 = $heap
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'JupilerLeague'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_METHOD_CALL                                         !0, 'insert'
          4        SEND_VAL_EX                                              <array>
          5        DO_FCALL                                      0          
   21     6        INIT_METHOD_CALL                                         !0, 'insert'
          7        SEND_VAL_EX                                              <array>
          8        DO_FCALL                                      0          
   22     9        INIT_METHOD_CALL                                         !0, 'insert'
         10        SEND_VAL_EX                                              <array>
         11        DO_FCALL                                      0          
   23    12        INIT_METHOD_CALL                                         !0, 'insert'
         13        SEND_VAL_EX                                              <array>
         14        DO_FCALL                                      0          
   24    15        INIT_METHOD_CALL                                         !0, 'insert'
         16        SEND_VAL_EX                                              <array>
         17        DO_FCALL                                      0          
   25    18        INIT_METHOD_CALL                                         !0, 'insert'
         19        SEND_VAL_EX                                              <array>
         20        DO_FCALL                                      0          
   28    21        INIT_FCALL                                               'print_r'
         22        INIT_FCALL                                               'iterator_to_array'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $10     
         25        SEND_VAR                                                 $10
         26        DO_ICALL                                                 
   29    27        INIT_FCALL                                               'print_r'
         28        INIT_FCALL                                               'iterator_to_array'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $12     
         31        SEND_VAR                                                 $12
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Class JupilerLeague:
Function compare:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KkdZ4
function name:  compare
number of ops:  24
compiled vars:  !0 = $array1, !1 = $array2, !2 = $values1, !3 = $values2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_FCALL                                               'array_values'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !2, $4
   12     6        INIT_FCALL                                               'array_values'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !3, $6
   13    10        FETCH_DIM_R                                      ~8      !2, 0
         11        FETCH_DIM_R                                      ~9      !3, 0
         12        IS_IDENTICAL                                             ~8, ~9
         13      > JMPZ                                                     ~10, ->15
         14    > > RETURN                                                   0
   14    15    >   FETCH_DIM_R                                      ~11     !2, 0
         16        FETCH_DIM_R                                      ~12     !3, 0
         17        IS_SMALLER                                               ~11, ~12
         18      > JMPZ                                                     ~13, ->21
         19    >   QM_ASSIGN                                        ~14     -1
         20      > JMP                                                      ->22
         21    >   QM_ASSIGN                                        ~14     1
         22    > > RETURN                                                   ~14
   15    23*     > RETURN                                                   null

End of function compare

End of class JupilerLeague.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.49 ms | 1404 KiB | 19 Q