3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Job { public function isEarlierThan(Job $other) { try { return rand(0, 10) < 5; } catch (Exception $e) { throw new Exception($other . ' ' . $e->getMessage()); } } } $jobs = array(new Job(), new Job(), new Job()); return rand(0, 10) < 5; usort($jobs, function($j1, $j2) { return $j1->isEarlierThan($j2) ? -1 : 1; });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QZiAQ
function name:  (null)
number of ops:  22
compiled vars:  !0 = $jobs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'Job'
          1        DO_FCALL                                      0          
          2        INIT_ARRAY                                       ~3      $1
          3        NEW                                              $4      'Job'
          4        DO_FCALL                                      0          
          5        ADD_ARRAY_ELEMENT                                ~3      $4
          6        NEW                                              $6      'Job'
          7        DO_FCALL                                      0          
          8        ADD_ARRAY_ELEMENT                                ~3      $6
          9        ASSIGN                                                   !0, ~3
   17    10        INIT_FCALL                                               'rand'
         11        SEND_VAL                                                 0
         12        SEND_VAL                                                 10
         13        DO_ICALL                                         $9      
         14        IS_SMALLER                                       ~10     $9, 5
         15      > RETURN                                                   ~10
   18    16*       INIT_FCALL                                               'usort'
         17*       SEND_REF                                                 !0
         18*       DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FQZiAQ%3A18%240'
   20    19*       SEND_VAL                                                 ~11
         20*       DO_ICALL                                                 
         21*     > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FQZiAQ%3A18%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QZiAQ
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $j1, !1 = $j2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        INIT_METHOD_CALL                                         !0, 'isEarlierThan'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0  $2      
          5      > JMPZ                                                     $2, ->8
          6    >   QM_ASSIGN                                        ~3      -1
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~3      1
          9    > > RETURN                                                   ~3
   20    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FQZiAQ%3A18%240

Class Job:
Function isearlierthan:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/QZiAQ
function name:  isEarlierThan
number of ops:  18
compiled vars:  !0 = $other, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'rand'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 10
          4        DO_ICALL                                         $2      
          5        IS_SMALLER                                       ~3      $2, 5
          6      > RETURN                                                   ~3
          7*       JMP                                                      ->17
    9     8  E > > CATCH                                       last         'Exception'
   10     9    >   NEW                                              $4      'Exception'
         10        CONCAT                                           ~5      !0, '+'
         11        INIT_METHOD_CALL                                         !1, 'getMessage'
         12        DO_FCALL                                      0  $6      
         13        CONCAT                                           ~7      ~5, $6
         14        SEND_VAL_EX                                              ~7
         15        DO_FCALL                                      0          
         16      > THROW                                         0          $4
   12    17*     > RETURN                                                   null

End of function isearlierthan

End of class Job.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.53 ms | 1400 KiB | 17 Q