3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test1() { echo __FUNCTION__; $s = microtime(true); $a = 15484; for ($i = 0; $i < 1000000; $i++) { $b = $a / 2; } return microtime(true) - $s; } function test2() { echo __FUNCTION__; $s = microtime(true); $a = 15484; for ($i = 0; $i < 1000000; $i++) { $b = $a >> 1; } return microtime(true) - $s; } echo test1()."\n"; echo test2()."\n"; echo test1()."\n"; echo test2()."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mEDpv
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'test1'
          1        DO_FCALL                                      0  $0      
          2        CONCAT                                           ~1      $0, '%0A'
          3        ECHO                                                     ~1
   32     4        INIT_FCALL                                               'test2'
          5        DO_FCALL                                      0  $2      
          6        CONCAT                                           ~3      $2, '%0A'
          7        ECHO                                                     ~3
   33     8        INIT_FCALL                                               'test1'
          9        DO_FCALL                                      0  $4      
         10        CONCAT                                           ~5      $4, '%0A'
         11        ECHO                                                     ~5
   34    12        INIT_FCALL                                               'test2'
         13        DO_FCALL                                      0  $6      
         14        CONCAT                                           ~7      $6, '%0A'
         15        ECHO                                                     ~7
         16      > RETURN                                                   1

Function test1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/mEDpv
function name:  test1
number of ops:  19
compiled vars:  !0 = $s, !1 = $a, !2 = $i, !3 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'test1'
    6     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
    8     5        ASSIGN                                                   !1, 15484
   10     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->11
   11     8    >   DIV                                              ~8      !1, 2
          9        ASSIGN                                                   !3, ~8
   10    10        PRE_INC                                                  !2
         11    >   IS_SMALLER                                               !2, 1000000
         12      > JMPNZ                                                    ~11, ->8
   14    13    >   INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $12     
         16        SUB                                              ~13     $12, !0
         17      > RETURN                                                   ~13
   15    18*     > RETURN                                                   null

End of function test1

Function test2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/mEDpv
function name:  test2
number of ops:  19
compiled vars:  !0 = $s, !1 = $a, !2 = $i, !3 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ECHO                                                     'test2'
   20     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
   22     5        ASSIGN                                                   !1, 15484
   24     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->11
   25     8    >   SR                                               ~8      !1, 1
          9        ASSIGN                                                   !3, ~8
   24    10        PRE_INC                                                  !2
         11    >   IS_SMALLER                                               !2, 1000000
         12      > JMPNZ                                                    ~11, ->8
   28    13    >   INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $12     
         16        SUB                                              ~13     $12, !0
         17      > RETURN                                                   ~13
   29    18*     > RETURN                                                   null

End of function test2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.38 ms | 1400 KiB | 19 Q