3v4l.org

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

Function row:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lAu7Y
function name:  row
number of ops:  17
compiled vars:  !0 = $name, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   45     2        INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 '%25-40s+%258s+x+10+%C2%B5s%0A'
          4        SEND_VAR                                                 !0
          5        INIT_FCALL                                               'number_format'
          6        INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $2      
          9        SUB                                              ~3      $2, !1
         10        MUL                                              ~4      ~3, 100000
         11        SEND_VAL                                                 ~4
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $5      
         14        SEND_VAR                                                 $5
         15        DO_ICALL                                                 
   46    16      > RETURN                                                   null

End of function row

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

End of function foo

End of class A0.

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

End of function foo

End of class A1.

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

End of function foo

End of class A2.

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

End of function foo

End of class A3.

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

End of function foo

End of class A4.

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

End of function foo

End of class A5.

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

End of function foo

End of class A6.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.02 ms | 1414 KiB | 22 Q