3v4l.org

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

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mHQXt
function name:  foo
number of ops:  3
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     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:
151.58 ms | 1404 KiB | 17 Q