3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function foo($a, $b) {} } $max = 5*1e1; $object = new A; $t = microtime (true); for ($i=0; $i<$max; $i++) { $object->foo(1, 'foo'); } echo $max.' x A::foo: '.round((microtime(true)-$t)*1e3, 2)." ms\n"; $t = microtime (true); for ($i=0; $i<$max; $i++) { call_user_func_array(array($object, 'foo'), array(1, 'foo')); } echo $max.' x call_user_func_array: '.round((microtime(true)-$t)*1e3, 2)." ms\n"; $t = microtime (true); $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<$max; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } echo $max.' x ReflectionMethod::invokeArgs: '.round((microtime(true)-$t)*1e3, 2)." ms\n"; $t = microtime (true); for ($j=0; $j<$max/10; $j++) { $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<10; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } } echo ($max/10).' x (10 x ReflectionMethod::invokeArgs): '.round((microtime(true)-$t)*1e3, 2)." ms\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 36
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 69
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 110
Branch analysis from position: 110
2 jumps found. (Code = 44) Position 1 = 113, Position 2 = 95
Branch analysis from position: 113
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 95
1 jumps found. (Code = 42) Position 1 = 107
Branch analysis from position: 107
2 jumps found. (Code = 44) Position 1 = 109, Position 2 = 102
Branch analysis from position: 109
2 jumps found. (Code = 44) Position 1 = 113, Position 2 = 95
Branch analysis from position: 113
Branch analysis from position: 95
Branch analysis from position: 102
2 jumps found. (Code = 44) Position 1 = 109, Position 2 = 102
Branch analysis from position: 109
Branch analysis from position: 102
Branch analysis from position: 69
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 69
Branch analysis from position: 76
Branch analysis from position: 69
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 36
Branch analysis from position: 45
Branch analysis from position: 36
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
Branch analysis from position: 10
filename:       /in/j2AK4
function name:  (null)
number of ops:  128
compiled vars:  !0 = $max, !1 = $object, !2 = $t, !3 = $i, !4 = $ref, !5 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, 50
    7     1        NEW                                              $7      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
    9     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $10     
          7        ASSIGN                                                   !2, $10
   10     8        ASSIGN                                                   !3, 0
          9      > JMP                                                      ->15
   11    10    >   INIT_METHOD_CALL                                         !1, 'foo'
         11        SEND_VAL_EX                                              1
         12        SEND_VAL_EX                                              'foo'
         13        DO_FCALL                                      0          
   10    14        PRE_INC                                                  !3
         15    >   IS_SMALLER                                               !3, !0
         16      > JMPNZ                                                    ~15, ->10
   13    17    >   CONCAT                                           ~16     !0, '+x+A%3A%3Afoo%3A+'
         18        INIT_FCALL                                               'round'
         19        INIT_FCALL                                               'microtime'
         20        SEND_VAL                                                 <true>
         21        DO_ICALL                                         $17     
         22        SUB                                              ~18     $17, !2
         23        MUL                                              ~19     ~18, 1000
         24        SEND_VAL                                                 ~19
         25        SEND_VAL                                                 2
         26        DO_ICALL                                         $20     
         27        CONCAT                                           ~21     ~16, $20
         28        CONCAT                                           ~22     ~21, '+ms%0A'
         29        ECHO                                                     ~22
   15    30        INIT_FCALL                                               'microtime'
         31        SEND_VAL                                                 <true>
         32        DO_ICALL                                         $23     
         33        ASSIGN                                                   !2, $23
   16    34        ASSIGN                                                   !3, 0
         35      > JMP                                                      ->43
   17    36    >   INIT_ARRAY                                       ~26     !1
         37        ADD_ARRAY_ELEMENT                                ~26     'foo'
         38        INIT_USER_CALL                                0          'call_user_func_array', ~26
         39        SEND_ARRAY                                               <array>
         40        CHECK_UNDEF_ARGS                                         
         41        DO_FCALL                                      0          
   16    42        PRE_INC                                                  !3
         43    >   IS_SMALLER                                               !3, !0
         44      > JMPNZ                                                    ~29, ->36
   19    45    >   CONCAT                                           ~30     !0, '+x+call_user_func_array%3A+'
         46        INIT_FCALL                                               'round'
         47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $31     
         50        SUB                                              ~32     $31, !2
         51        MUL                                              ~33     ~32, 1000
         52        SEND_VAL                                                 ~33
         53        SEND_VAL                                                 2
         54        DO_ICALL                                         $34     
         55        CONCAT                                           ~35     ~30, $34
         56        CONCAT                                           ~36     ~35, '+ms%0A'
         57        ECHO                                                     ~36
   21    58        INIT_FCALL                                               'microtime'
         59        SEND_VAL                                                 <true>
         60        DO_ICALL                                         $37     
         61        ASSIGN                                                   !2, $37
   22    62        NEW                                              $39     'ReflectionMethod'
         63        SEND_VAR_EX                                              !1
         64        SEND_VAL_EX                                              'foo'
         65        DO_FCALL                                      0          
         66        ASSIGN                                                   !4, $39
   23    67        ASSIGN                                                   !3, 0
         68      > JMP                                                      ->74
   24    69    >   INIT_METHOD_CALL                                         !4, 'invokeArgs'
         70        SEND_VAR_EX                                              !1
         71        SEND_VAL_EX                                              <array>
         72        DO_FCALL                                      0          
   23    73        PRE_INC                                                  !3
         74    >   IS_SMALLER                                               !3, !0
         75      > JMPNZ                                                    ~45, ->69
   26    76    >   CONCAT                                           ~46     !0, '+x+ReflectionMethod%3A%3AinvokeArgs%3A+'
         77        INIT_FCALL                                               'round'
         78        INIT_FCALL                                               'microtime'
         79        SEND_VAL                                                 <true>
         80        DO_ICALL                                         $47     
         81        SUB                                              ~48     $47, !2
         82        MUL                                              ~49     ~48, 1000
         83        SEND_VAL                                                 ~49
         84        SEND_VAL                                                 2
         85        DO_ICALL                                         $50     
         86        CONCAT                                           ~51     ~46, $50
         87        CONCAT                                           ~52     ~51, '+ms%0A'
         88        ECHO                                                     ~52
   28    89        INIT_FCALL                                               'microtime'
         90        SEND_VAL                                                 <true>
         91        DO_ICALL                                         $53     
         92        ASSIGN                                                   !2, $53
   29    93        ASSIGN                                                   !5, 0
         94      > JMP                                                      ->110
   30    95    >   NEW                                              $56     'ReflectionMethod'
         96        SEND_VAR_EX                                              !1
         97        SEND_VAL_EX                                              'foo'
         98        DO_FCALL                                      0          
         99        ASSIGN                                                   !4, $56
   31   100        ASSIGN                                                   !3, 0
        101      > JMP                                                      ->107
   32   102    >   INIT_METHOD_CALL                                         !4, 'invokeArgs'
        103        SEND_VAR_EX                                              !1
        104        SEND_VAL_EX                                              <array>
        105        DO_FCALL                                      0          
   31   106        PRE_INC                                                  !3
        107    >   IS_SMALLER                                               !3, 10
        108      > JMPNZ                                                    ~62, ->102
   29   109    >   PRE_INC                                                  !5
        110    >   DIV                                              ~64     !0, 10
        111        IS_SMALLER                                               !5, ~64
        112      > JMPNZ                                                    ~65, ->95
   35   113    >   DIV                                              ~66     !0, 10
        114        CONCAT                                           ~67     ~66, '+x+%2810+x+ReflectionMethod%3A%3AinvokeArgs%29%3A+'
        115        INIT_FCALL                                               'round'
        116        INIT_FCALL                                               'microtime'
        117        SEND_VAL                                                 <true>
        118        DO_ICALL                                         $68     
        119        SUB                                              ~69     $68, !2
        120        MUL                                              ~70     ~69, 1000
        121        SEND_VAL                                                 ~70
        122        SEND_VAL                                                 2
        123        DO_ICALL                                         $71     
        124        CONCAT                                           ~72     ~67, $71
        125        CONCAT                                           ~73     ~72, '+ms%0A'
        126        ECHO                                                     ~73
        127      > RETURN                                                   1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j2AK4
function name:  foo
number of ops:  3
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function foo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.87 ms | 1408 KiB | 17 Q