3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $_field = "abcdefghijklmnopqrstuvwxyz"; public function __get($name) { echo 'method called' . PHP_EOL; } } class B { public $_field = "abcdefghijklmnopqrstuvwxyz"; } $a = new A; $start = microtime(true); for ($i = 0; $i < 100000; $i++) $field = $a->_field; $time_taken = microtime(true) - $start; echo 'With get: ' . $time_taken . 's' . PHP_EOL; $b = new B; $start = microtime(true); for ($i = 0; $i < 100000; $i++) $field = $b->_field; $time_taken = microtime(true) - $start; echo 'Without get: ' . $time_taken . 's' . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 9
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 32
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 32
Branch analysis from position: 37
Branch analysis from position: 32
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 9
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/7lSVo
function name:  (null)
number of ops:  47
compiled vars:  !0 = $a, !1 = $start, !2 = $i, !3 = $field, !4 = $time_taken, !5 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $6      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $6
   19     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !1, $9
   20     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->12
          9    >   FETCH_OBJ_R                                      ~12     !0, '_field'
         10        ASSIGN                                                   !3, ~12
         11        PRE_INC                                                  !2
         12    >   IS_SMALLER                                               !2, 100000
         13      > JMPNZ                                                    ~15, ->9
   21    14    >   INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $16     
         17        SUB                                              ~17     $16, !1
         18        ASSIGN                                                   !4, ~17
   23    19        CONCAT                                           ~19     'With+get%3A++++', !4
         20        CONCAT                                           ~20     ~19, 's'
         21        CONCAT                                           ~21     ~20, '%0A'
         22        ECHO                                                     ~21
   25    23        NEW                                              $22     'B'
         24        DO_FCALL                                      0          
         25        ASSIGN                                                   !5, $22
   27    26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $25     
         29        ASSIGN                                                   !1, $25
   28    30        ASSIGN                                                   !2, 0
         31      > JMP                                                      ->35
         32    >   FETCH_OBJ_R                                      ~28     !5, '_field'
         33        ASSIGN                                                   !3, ~28
         34        PRE_INC                                                  !2
         35    >   IS_SMALLER                                               !2, 100000
         36      > JMPNZ                                                    ~31, ->32
   29    37    >   INIT_FCALL                                               'microtime'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $32     
         40        SUB                                              ~33     $32, !1
         41        ASSIGN                                                   !4, ~33
   31    42        CONCAT                                           ~35     'Without+get%3A+', !4
         43        CONCAT                                           ~36     ~35, 's'
         44        CONCAT                                           ~37     ~36, '%0A'
         45        ECHO                                                     ~37
         46      > RETURN                                                   1

Class A:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lSVo
function name:  __get
number of ops:  3
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ECHO                                                     'method+called%0A'
    9     2      > RETURN                                                   null

End of function __get

End of class A.

Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.44 ms | 1392 KiB | 15 Q