3v4l.org

run code in 300+ PHP versions simultaneously
<?php global $throw; $throw = false; function foo() { bar(); } function bar() { baz(); } function baz() { boom(); } function boom() { global $throw; if ($throw) { throw new RuntimeException(); } } function test($n) { for ($i = 0; $i < $n; $i++) { try { foo(); } catch (RuntimeException $e) { return false; } } } $n = 1000000; $t = microtime(true); test($n); echo (microtime(true) - $t)*1000000/$n . ' us/iteration';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oZrQb
function name:  (null)
number of ops:  19
compiled vars:  !0 = $throw, !1 = $n, !2 = $t
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   BIND_GLOBAL                                              !0, 'throw'
   4     1        QM_ASSIGN                                                !0
  35     2        QM_ASSIGN                                                !1
  36     3        INIT_FCALL                                               'microtime'
         4        SEND_VAL                                                 <true>
         5        DO_ICALL                                         $5      
         6        QM_ASSIGN                                                !2
  37     7        INIT_FCALL                                               'test'
         8        SEND_VAR                                                 !1
         9        DO_FCALL                                      0          
  38    10        INIT_FCALL                                               'microtime'
        11        SEND_VAL                                                 <true>
        12        DO_ICALL                                         $8      
        13        SUB                                              ~9      $8, !2
        14        MUL                                              ~10     ~9, 1000000
        15        DIV                                              ~11     ~10, !1
        16        CONCAT                                           ~12     ~11, '+us%2Fiteration'
        17        ASSIGN_OBJ                                               ~12
        18      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oZrQb
function name:  foo
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   7     0  E >   INIT_FCALL_BY_NAME                                       'bar'
         1        DO_FCALL                                      0          
   8     2      > RETURN                                                   null

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oZrQb
function name:  bar
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  11     0  E >   INIT_FCALL_BY_NAME                                       'baz'
         1        DO_FCALL                                      0          
  12     2      > RETURN                                                   null

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oZrQb
function name:  baz
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E >   INIT_FCALL_BY_NAME                                       'boom'
         1        DO_FCALL                                      0          
  16     2      > RETURN                                                   null

End of function baz

Function boom:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oZrQb
function name:  boom
number of ops:  6
compiled vars:  !0 = $throw
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  19     0  E >   BIND_GLOBAL                                              !0, 'throw'
  20     1      > JMPZ                                                     !0, ->5
  21     2    >   NEW                                              $1      :4
         3        DO_FCALL                                      0          
         4      > THROW                                         0          $1
  23     5    > > RETURN                                                   null

End of function boom

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
Branch analysis from position: 3
Found catch point at position: 6
Branch analysis from position: 6
2 jumps found. (Code = 107) Position 1 = 7, Position 2 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oZrQb
function name:  test
number of ops:  13
compiled vars:  !0 = $n, !1 = $i, !2 = $e
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  25     0  E >   RECV                                             !0      
  26     1        QM_ASSIGN                                                !1
         2      > JMP                                                      ->10
  28     3    >   INIT_FCALL                                               'foo'
         4        DO_FCALL                                      0          
         5      > JMP                                                      ->8
  29     6  E > > CATCH                                       last         'RuntimeException'
  30     7    > > RETURN                                                   <false>
  26     8    >   POST_INC                                         ~5      !1
         9        FREE                                                     ~5
        10    >   IS_SMALLER_OR_EQUAL                              ~6      !1, !0
        11      > JMPNZ                                                    ~6, ->3
  33    12    > > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
13.68 ms | 416 KiB | 7 Q