3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test1() { $s = microtime(true); for ($i = 0; $i < 1000000; $i++) { } return microtime(true) - $s; } function test2() { $s = microtime(true); $i = 0; while ($i < 1000000) { $i++; } return microtime(true) - $s; } function test3() { $s = microtime(true); $i = 0; while ($i++ < 1000000) { } return microtime(true) - $s; } function test4() { $s = microtime(true); for ($i = 0; $i < 1000000; $i++); return microtime(true) - $s; } function test5() { $s = microtime(true); $i = 0; while ($i++ < 1000000); return microtime(true) - $s; } function test6() { $s = microtime(true); $range = range(0, 999999); foreach ($range as $i) { } return microtime(true) - $s; } echo test1() . "\n\n"; echo test2() . "\n\n"; echo test3() . "\n\n"; echo test4() . "\n\n"; echo test5() . "\n\n"; echo test6() . "\n\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WP6av
function name:  (null)
number of ops:  25
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   INIT_FCALL                                               'test1'
          1        DO_FCALL                                      0  $0      
          2        CONCAT                                           ~1      $0, '%0A%0A'
          3        ECHO                                                     ~1
   54     4        INIT_FCALL                                               'test2'
          5        DO_FCALL                                      0  $2      
          6        CONCAT                                           ~3      $2, '%0A%0A'
          7        ECHO                                                     ~3
   55     8        INIT_FCALL                                               'test3'
          9        DO_FCALL                                      0  $4      
         10        CONCAT                                           ~5      $4, '%0A%0A'
         11        ECHO                                                     ~5
   56    12        INIT_FCALL                                               'test4'
         13        DO_FCALL                                      0  $6      
         14        CONCAT                                           ~7      $6, '%0A%0A'
         15        ECHO                                                     ~7
   57    16        INIT_FCALL                                               'test5'
         17        DO_FCALL                                      0  $8      
         18        CONCAT                                           ~9      $8, '%0A%0A'
         19        ECHO                                                     ~9
   58    20        INIT_FCALL                                               'test6'
         21        DO_FCALL                                      0  $10     
         22        CONCAT                                           ~11     $10, '%0A%0A'
         23        ECHO                                                     ~11
         24      > RETURN                                                   1

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

End of function test1

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

End of function test2

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

End of function test3

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

End of function test4

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

End of function test5

Function test6:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/WP6av
function name:  test6
number of ops:  19
compiled vars:  !0 = $s, !1 = $range, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $3      
          3        ASSIGN                                                   !0, $3
   44     4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 999999
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !1, $5
   45     9      > FE_RESET_R                                       $7      !1, ->12
         10    > > FE_FETCH_R                                               $7, !2, ->12
         11    > > JMP                                                      ->10
         12    >   FE_FREE                                                  $7
   49    13        INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $8      
         16        SUB                                              ~9      $8, !0
         17      > RETURN                                                   ~9
   50    18*     > RETURN                                                   null

End of function test6

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.67 ms | 1411 KiB | 25 Q