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, new A5) ; $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 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 26
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 50
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 95
Branch analysis from position: 95
2 jumps found. (Code = 44) Position 1 = 97, Position 2 = 76
Branch analysis from position: 97
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
2 jumps found. (Code = 44) Position 1 = 94, Position 2 = 85
Branch analysis from position: 94
2 jumps found. (Code = 44) Position 1 = 97, Position 2 = 76
Branch analysis from position: 97
Branch analysis from position: 76
Branch analysis from position: 85
2 jumps found. (Code = 44) Position 1 = 94, Position 2 = 85
Branch analysis from position: 94
Branch analysis from position: 85
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 52
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 50
Branch analysis from position: 65
Branch analysis from position: 50
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 52
Branch analysis from position: 62
Branch analysis from position: 52
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 28
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 26
Branch analysis from position: 39
Branch analysis from position: 26
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 28
Branch analysis from position: 36
Branch analysis from position: 28
filename:       /in/easT9
function name:  (null)
number of ops:  103
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        NEW                                              $18     'A5'
         17        DO_FCALL                                      0          
         18        ADD_ARRAY_ELEMENT                                ~9      $18
         19        ASSIGN                                                   !1, ~9
   39    20        INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $21     
         23        ASSIGN                                                   !2, $21
   40    24        ASSIGN                                                   !3, 0
         25      > JMP                                                      ->37
   41    26    >   ASSIGN                                                   !4, 0
         27      > JMP                                                      ->34
   42    28    >   FETCH_DIM_R                                      ~25     !1, !3
         29        INIT_METHOD_CALL                                         ~25, 'foo'
         30        SEND_VAL_EX                                              1
         31        SEND_VAL_EX                                              'foo'
         32        DO_FCALL                                      0          
   41    33        PRE_INC                                                  !4
         34    >   IS_SMALLER                                               !4, !0
         35      > JMPNZ                                                    ~28, ->28
   40    36    >   PRE_INC                                                  !3
         37    >   IS_SMALLER                                               !3, 5
         38      > JMPNZ                                                    ~30, ->26
   45    39    >   INIT_FCALL                                               'row'
         40        CONCAT                                           ~31     !0, '+x+A%3A%3Afoo'
         41        SEND_VAL                                                 ~31
         42        SEND_VAR                                                 !2
         43        DO_FCALL                                      0          
   47    44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $33     
         47        ASSIGN                                                   !2, $33
   48    48        ASSIGN                                                   !3, 0
         49      > JMP                                                      ->63
   49    50    >   ASSIGN                                                   !4, 0
         51      > JMP                                                      ->60
   50    52    >   FETCH_DIM_R                                      ~37     !1, !3
         53        INIT_ARRAY                                       ~38     ~37
         54        ADD_ARRAY_ELEMENT                                ~38     'foo'
         55        INIT_USER_CALL                                0          'call_user_func_array', ~38
         56        SEND_ARRAY                                               <array>
         57        CHECK_UNDEF_ARGS                                         
         58        DO_FCALL                                      0          
   49    59        PRE_INC                                                  !4
         60    >   IS_SMALLER                                               !4, !0
         61      > JMPNZ                                                    ~41, ->52
   48    62    >   PRE_INC                                                  !3
         63    >   IS_SMALLER                                               !3, 5
         64      > JMPNZ                                                    ~43, ->50
   53    65    >   INIT_FCALL                                               'row'
         66        CONCAT                                           ~44     !0, '+x+call_user_func_array'
         67        SEND_VAL                                                 ~44
         68        SEND_VAR                                                 !2
         69        DO_FCALL                                      0          
   55    70        INIT_FCALL                                               'microtime'
         71        SEND_VAL                                                 <true>
         72        DO_ICALL                                         $46     
         73        ASSIGN                                                   !2, $46
   56    74        ASSIGN                                                   !3, 0
         75      > JMP                                                      ->95
   57    76    >   NEW                                              $49     'ReflectionMethod'
         77        CHECK_FUNC_ARG                                           
         78        FETCH_DIM_FUNC_ARG                               $50     !1, !3
         79        SEND_FUNC_ARG                                            $50
         80        SEND_VAL_EX                                              'foo'
         81        DO_FCALL                                      0          
         82        ASSIGN                                                   !5, $49
   58    83        ASSIGN                                                   !4, 0
         84      > JMP                                                      ->92
   59    85    >   INIT_METHOD_CALL                                         !5, 'invokeArgs'
         86        CHECK_FUNC_ARG                                           
         87        FETCH_DIM_FUNC_ARG                               $54     !1, !3
         88        SEND_FUNC_ARG                                            $54
         89        SEND_VAL_EX                                              <array>
         90        DO_FCALL                                      0          
   58    91        PRE_INC                                                  !4
         92    >   IS_SMALLER                                               !4, !0
         93      > JMPNZ                                                    ~57, ->85
   56    94    >   PRE_INC                                                  !3
         95    >   IS_SMALLER                                               !3, 5
         96      > JMPNZ                                                    ~59, ->76
   62    97    >   INIT_FCALL                                               'row'
         98        CONCAT                                           ~60     !0, '+x+ReflectionMethod%3A%3AinvokeArgs'
         99        SEND_VAL                                                 ~60
        100        SEND_VAR                                                 !2
        101        DO_FCALL                                      0          
        102      > RETURN                                                   1

Function row:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/easT9
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/easT9
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/easT9
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/easT9
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/easT9
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/easT9
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:
148.16 ms | 1415 KiB | 22 Q