3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! class foo { function doSomething($a) { return $a + 2; } } $start = microtime(true); $foo = new foo(); for ($i = 0; $i < 100000; $i++) { $foo->doSomething(1); } $end1 = (microtime(true) - $start); echo $end1 . PHP_EOL; $start = microtime(true); $foo = new foo(); $doSomething = new \reflectionMethod('foo', 'doSomething'); for ($i = 0; $i < 100000; $i++) { $doSomething->invoke($foo, 1); } $end2 = (microtime(true) - $start); echo $end2 . PHP_EOL; var_dump($end2 - $end1);
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 = 9
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 36
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 36
Branch analysis from position: 43
Branch analysis from position: 36
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 9
Branch analysis from position: 15
Branch analysis from position: 9
filename:       /in/7bUfZ
function name:  (null)
number of ops:  55
compiled vars:  !0 = $start, !1 = $foo, !2 = $i, !3 = $end1, !4 = $doSomething, !5 = $end2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $6      
          3        ASSIGN                                                   !0, $6
    9     4        NEW                                              $8      'foo'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $8
   10     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->13
   12     9    >   INIT_METHOD_CALL                                         !1, 'doSomething'
         10        SEND_VAL_EX                                              1
         11        DO_FCALL                                      0          
   10    12        PRE_INC                                                  !2
         13    >   IS_SMALLER                                               !2, 100000
         14      > JMPNZ                                                    ~14, ->9
   14    15    >   INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $15     
         18        SUB                                              ~16     $15, !0
         19        ASSIGN                                                   !3, ~16
   15    20        CONCAT                                           ~18     !3, '%0A'
         21        ECHO                                                     ~18
   17    22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $19     
         25        ASSIGN                                                   !0, $19
   18    26        NEW                                              $21     'foo'
         27        DO_FCALL                                      0          
         28        ASSIGN                                                   !1, $21
   19    29        NEW                                              $24     'reflectionMethod'
         30        SEND_VAL_EX                                              'foo'
         31        SEND_VAL_EX                                              'doSomething'
         32        DO_FCALL                                      0          
         33        ASSIGN                                                   !4, $24
   20    34        ASSIGN                                                   !2, 0
         35      > JMP                                                      ->41
   22    36    >   INIT_METHOD_CALL                                         !4, 'invoke'
         37        SEND_VAR_EX                                              !1
         38        SEND_VAL_EX                                              1
         39        DO_FCALL                                      0          
   20    40        PRE_INC                                                  !2
         41    >   IS_SMALLER                                               !2, 100000
         42      > JMPNZ                                                    ~30, ->36
   24    43    >   INIT_FCALL                                               'microtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $31     
         46        SUB                                              ~32     $31, !0
         47        ASSIGN                                                   !5, ~32
   25    48        CONCAT                                           ~34     !5, '%0A'
         49        ECHO                                                     ~34
   27    50        INIT_FCALL                                               'var_dump'
         51        SUB                                              ~35     !5, !3
         52        SEND_VAL                                                 ~35
         53        DO_ICALL                                                 
         54      > RETURN                                                   1

Class foo:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7bUfZ
function name:  doSomething
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        ADD                                              ~1      !0, 2
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function dosomething

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.4 ms | 1400 KiB | 17 Q