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<100; $i++) { call_user_func_array(array($object, 'foo'), array(1, 'foo')); } echo 'call_user_func_array: '.round((microtime(true)-$t)*1000, 2)." ms\n"; $t = microtime (true); $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<100; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } echo '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 = 62) Position 1 = -2
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/anval
function name:  (null)
number of ops:  61
compiled vars:  !0 = $object, !1 = $t, !2 = $i, !3 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $4      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    9     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !1, $7
   10     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->16
   11     9    >   INIT_ARRAY                                       ~10     !0
         10        ADD_ARRAY_ELEMENT                                ~10     'foo'
         11        INIT_USER_CALL                                0          'call_user_func_array', ~10
         12        SEND_ARRAY                                               <array>
         13        CHECK_UNDEF_ARGS                                         
         14        DO_FCALL                                      0          
   10    15        PRE_INC                                                  !2
         16    >   IS_SMALLER                                               !2, 100
         17      > JMPNZ                                                    ~13, ->9
   13    18    >   INIT_FCALL                                               'round'
         19        INIT_FCALL                                               'microtime'
         20        SEND_VAL                                                 <true>
         21        DO_ICALL                                         $14     
         22        SUB                                              ~15     $14, !1
         23        MUL                                              ~16     ~15, 1000
         24        SEND_VAL                                                 ~16
         25        SEND_VAL                                                 2
         26        DO_ICALL                                         $17     
         27        CONCAT                                           ~18     'call_user_func_array%3A+', $17
         28        CONCAT                                           ~19     ~18, '+ms%0A'
         29        ECHO                                                     ~19
   15    30        INIT_FCALL                                               'microtime'
         31        SEND_VAL                                                 <true>
         32        DO_ICALL                                         $20     
         33        ASSIGN                                                   !1, $20
   16    34        NEW                                              $22     'ReflectionMethod'
         35        SEND_VAR_EX                                              !0
         36        SEND_VAL_EX                                              'foo'
         37        DO_FCALL                                      0          
         38        ASSIGN                                                   !3, $22
   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, 100
         47      > JMPNZ                                                    ~28, ->41
   20    48    >   INIT_FCALL                                               'round'
         49        INIT_FCALL                                               'microtime'
         50        SEND_VAL                                                 <true>
         51        DO_ICALL                                         $29     
         52        SUB                                              ~30     $29, !1
         53        MUL                                              ~31     ~30, 1000
         54        SEND_VAL                                                 ~31
         55        SEND_VAL                                                 2
         56        DO_ICALL                                         $32     
         57        CONCAT                                           ~33     'ReflectionMethod%3A%3AinvokeArgs%3A+', $32
         58        CONCAT                                           ~34     ~33, '+ms%0A'
         59        ECHO                                                     ~34
         60      > RETURN                                                   1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/anval
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:
141.66 ms | 1400 KiB | 17 Q