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

Function row:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFrvU
function name:  row
number of ops:  17
compiled vars:  !0 = $name, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   33     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                                                 
   34    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/QFrvU
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/QFrvU
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/QFrvU
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/QFrvU
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/QFrvU
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.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.94 ms | 1415 KiB | 22 Q