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) { echo $e->getLine(); } } } $t = microtime(); test(100000); echo (microtime() - $t) . ' us';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/svHTv
function name:  (null)
number of ops:  14
compiled vars:  !0 = $throw, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   BIND_GLOBAL                                              !0, 'throw'
    4     1        ASSIGN                                                   !0, <false>
   35     2        INIT_FCALL                                               'microtime'
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   36     5        INIT_FCALL                                               'test'
          6        SEND_VAL                                                 100000
          7        DO_FCALL                                      0          
   37     8        INIT_FCALL                                               'microtime'
          9        DO_ICALL                                         $6      
         10        SUB                                              ~7      $6, !1
         11        CONCAT                                           ~8      ~7, '+us'
         12        ECHO                                                     ~8
         13      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/svHTv
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/svHTv
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/svHTv
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/svHTv
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      'RuntimeException'
          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 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
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
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
Branch analysis from position: 3
filename:       /in/svHTv
function name:  test
number of ops:  14
compiled vars:  !0 = $n, !1 = $i, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->11
   28     3    >   INIT_FCALL                                               'foo'
          4        DO_FCALL                                      0          
          5      > JMP                                                      ->10
   29     6  E > > CATCH                                       last         'RuntimeException'
   30     7    >   INIT_METHOD_CALL                                         !2, 'getLine'
          8        DO_FCALL                                      0  $5      
          9        ECHO                                                     $5
   26    10    >   PRE_INC                                                  !1
         11    >   IS_SMALLER                                               !1, !0
         12      > JMPNZ                                                    ~7, ->3
   33    13    > > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.14 ms | 943 KiB | 18 Q