3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = 'bar'; } $foo = new Foo; $rounds = 1000000; $start = microtime(true); for($i=0; $i<$rounds; $i++) { $var = $foo->bar; } echo (microtime(true) - $start); echo "\n"; $start = microtime(true); $refl = new ReflectionProperty('Foo', 'bar'); for($i=0; $i<$rounds; $i++) { $var = $refl->getValue(); } echo (microtime(true) - $start); echo "\n"; $start = microtime(true); for($i=0; $i<$rounds; $i++) { $var = (new ReflectionProperty('Foo', 'bar'))->getValue(); } echo (microtime(true) - $start);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 10
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 32
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 50
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 50
Branch analysis from position: 60
Branch analysis from position: 50
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 32
Branch analysis from position: 38
Branch analysis from position: 32
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 10
Branch analysis from position: 15
Branch analysis from position: 10
filename:       /in/JXK5N
function name:  (null)
number of ops:  66
compiled vars:  !0 = $foo, !1 = $rounds, !2 = $start, !3 = $i, !4 = $var, !5 = $refl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $6      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $6
    9     3        ASSIGN                                                   !1, 1000000
   11     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $10     
          7        ASSIGN                                                   !2, $10
   12     8        ASSIGN                                                   !3, 0
          9      > JMP                                                      ->13
   13    10    >   FETCH_OBJ_R                                      ~13     !0, 'bar'
         11        ASSIGN                                                   !4, ~13
   12    12        PRE_INC                                                  !3
         13    >   IS_SMALLER                                               !3, !1
         14      > JMPNZ                                                    ~16, ->10
   15    15    >   INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $17     
         18        SUB                                              ~18     $17, !2
         19        ECHO                                                     ~18
   17    20        ECHO                                                     '%0A'
   19    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $19     
         24        ASSIGN                                                   !2, $19
   20    25        NEW                                              $21     'ReflectionProperty'
         26        SEND_VAL_EX                                              'Foo'
         27        SEND_VAL_EX                                              'bar'
         28        DO_FCALL                                      0          
         29        ASSIGN                                                   !5, $21
   21    30        ASSIGN                                                   !3, 0
         31      > JMP                                                      ->36
   22    32    >   INIT_METHOD_CALL                                         !5, 'getValue'
         33        DO_FCALL                                      0  $25     
         34        ASSIGN                                                   !4, $25
   21    35        PRE_INC                                                  !3
         36    >   IS_SMALLER                                               !3, !1
         37      > JMPNZ                                                    ~28, ->32
   24    38    >   INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $29     
         41        SUB                                              ~30     $29, !2
         42        ECHO                                                     ~30
   26    43        ECHO                                                     '%0A'
   28    44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $31     
         47        ASSIGN                                                   !2, $31
   29    48        ASSIGN                                                   !3, 0
         49      > JMP                                                      ->58
   30    50    >   NEW                                              $34     'ReflectionProperty'
         51        SEND_VAL_EX                                              'Foo'
         52        SEND_VAL_EX                                              'bar'
         53        DO_FCALL                                      0          
         54        INIT_METHOD_CALL                                         $34, 'getValue'
         55        DO_FCALL                                      0  $36     
         56        ASSIGN                                                   !4, $36
   29    57        PRE_INC                                                  !3
         58    >   IS_SMALLER                                               !3, !1
         59      > JMPNZ                                                    ~39, ->50
   32    60    >   INIT_FCALL                                               'microtime'
         61        SEND_VAL                                                 <true>
         62        DO_ICALL                                         $40     
         63        SUB                                              ~41     $40, !2
         64        ECHO                                                     ~41
         65      > RETURN                                                   1

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.7 ms | 1405 KiB | 15 Q