3v4l.org

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

Class Foo:
Function setbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n3g0Z
function name:  setBar
number of ops:  4
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'bar'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function setbar

Function getbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n3g0Z
function name:  getBar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'bar'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function getbar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.65 ms | 1404 KiB | 17 Q